Revision history for CodingConventions


Revision [39263]

Last edited on 2020-06-04 05:47:57 by PhilDaintree
Additions:
|=|{{image alt="webERP logo" title="webERP Logo" url="images/webERPlogo.gif"}}|=|[[HomePage | What Is webERP]] |=| [[WeberpFeatures | webERP Features]] |=|[[WeberpFaq | Documentation]]||
Deletions:
|=|{{image alt="webERP logo" title="webERP Logo" url="images/webERPlogo.gif"}}|=|[[HomePage | What Is webERP]] |=| [[WeberpFeatures webERP Features]] |=|[[WeberpFaq | Documentation]]||


Revision [39262]

Edited on 2020-06-04 05:47:45 by PhilDaintree
Additions:
|=|{{image alt="webERP logo" title="webERP Logo" url="images/webERPlogo.gif"}}|=|[[HomePage | What Is webERP]] |=| [[WeberpFeatures webERP Features]] |=|[[WeberpFaq | Documentation]]||
|=|[[WeberpSupport | Support]] |=|[[http://www.weberp.org/forum Forum]] |=|{{image class="center" alt="Sourceforge Logo" title="Sourceforge Logo" url="http://sflogo.sourceforge.net/sflogo.php?group_id=70949&type=9" link="http://sourceforge.net/projects/web-erp"}} |=| [[http://sourceforge.net/project/platformdownload.php?group_id=70949&sel_platform=3757 Download]] |=| [[http://www.weberp.org/weberp/index.php Demo]] |=|[[WeberpDevelopment | Development]]||
Deletions:
|=|{{image alt="webERP logo" title="webERP Logo" url="images/webERPlogo.gif"}}|=|[[HomePage What Is webERP]] |=| [[WeberpFeatures webERP Features]] |=|[[WeberpFaq Documentation]]||
|=|[[WeberpSupport Support]] |=|[[http://www.weberp.org/forum Forum]] |=|{{image class="center" alt="Sourceforge Logo" title="Sourceforge Logo" url="http://sflogo.sourceforge.net/sflogo.php?group_id=70949&type=9" link="http://sourceforge.net/projects/web-erp"}} |=| [[http://sourceforge.net/project/platformdownload.php?group_id=70949&sel_platform=3757 Download]] |=| [[http://www.weberp.org/weberp/index.php Demo]] |=|[[WeberpDevelopment Development]]||


Revision [2444]

Edited on 2012-02-17 02:18:38 by PhilDaintree
Additions:
if ($OneTwoThree==$_POST['OneTwoThree']
AND $myrow['onetwothree']==$_SESSION['OneTwoThree']) {


Revision [2443]

Edited on 2012-02-17 02:17:26 by PhilDaintree
Additions:
**PHP Functions and Keywords**
Always in lower case
**With the Exception of PHP Logical Operators**
i.e. AND and OR
Always in UPPER CASE - the upper case separates the predominantely lower case comparison expressions for improved readability.
e.g.
if ($OneTwoThree==$_POST['OneTwoThree'] and $myrow['onetwothree']==$_SESSION['OneTwoThree']) {
if ($OneTwoThree==$_POST['OneTwoThree'] AND $myrow['onetwothree']==$_SESSION['OneTwoThree']) {
Where there are many comaparisons new lines should be created for each comparison


Revision [2407]

Edited on 2012-01-21 19:28:45 by PhilDaintree
Additions:
|=|{{image alt="webERP logo" title="webERP Logo" url="images/webERPlogo.gif"}}|=|[[HomePage What Is webERP]] |=| [[WeberpFeatures webERP Features]] |=|[[WeberpFaq Documentation]]||
|=|[[WeberpSupport Support]] |=|[[http://www.weberp.org/forum Forum]] |=|{{image class="center" alt="Sourceforge Logo" title="Sourceforge Logo" url="http://sflogo.sourceforge.net/sflogo.php?group_id=70949&type=9" link="http://sourceforge.net/projects/web-erp"}} |=| [[http://sourceforge.net/project/platformdownload.php?group_id=70949&sel_platform=3757 Download]] |=| [[http://www.weberp.org/weberp/index.php Demo]] |=|[[WeberpDevelopment Development]]||
Deletions:
|=|{{image alt="webERP logo" title="webERP Logo" url="images/webERPlogo.gif"}}|=|[[HomePage What Is webERP]] |=| [[WeberpFeatures webERP Features]] |=|[[WeberpFaq FAQs]]|=|
|=|[[WeberpSupport Support]] |=| [[http://sourceforge.net/projects/web-erp Sourceforge Project Page]] |=| [[http://sourceforge.net/project/platformdownload.php?group_id=70949&sel_platform=3757 Download]] |=| [[http://www.weberp.org/weberp/index.php Demo]] |=|[[WeberpDevelopment Development]]||


Revision [2281]

Edited on 2011-12-03 20:42:27 by PhilDaintree
Additions:
This should be avoided in favour of using $_POST['StartingCustomer'] everywhere it is required so the reader can see where the variable comes from.
echo _('Some text with a') . ' ' . $Variable;
to reduce the parsing job required of the web-server. Notice all strings need to be inside the gettext _() function.
Most programming editors have word wrap and this is preferred to manual line breaks.
All scripts should have a comment in the first few lines with the script name and revision number in it if the following comment is pasted into it the SVN repository automatically updates the revision number.
/* $Id: AccountGroups.php 4735 2011-10-29 05:59:53Z daintree $*/
Deletions:
This should be avoided in favour of using $_POST['StartAtCustomer'] everywhere it is required so the reader can see where the variable comes from.
echo 'Some text with a ' . $Variable;
to reduce the parsing job required of the web-server.
It is recommended that you break lines at approximately 75-85 characters.
All scripts should have a comment in the first few lines with the script revision number in it if the following comment is pasted into it the CVS automatically updates the revision number.
/* $Revision: 1.7 $ */


Revision [2253]

Edited on 2011-11-02 01:46:50 by PhilDaintree
Additions:
All control structures (these include if, for, while, switch) must always use [[http://en.wikipedia.org/wiki/Indent_style#Variant:_1TBS "1 True Brace" style statement blocks]].
Deletions:
All control structures (these include if, for, while, switch) must always use ((http://en.wikipedia.org/wiki/Indent_style#Variant:_1TBS "1 True Brace" style statement blocks)).


Revision [2252]

Edited on 2011-11-02 01:46:01 by PhilDaintree
Additions:
All control structures (these include if, for, while, switch) must always use ((http://en.wikipedia.org/wiki/Indent_style#Variant:_1TBS "1 True Brace" style statement blocks)).
Deletions:
All control structures (these include if, for, while, switch) must always use "Kernighan and Richie" style statement blocks.


Revision [2098]

Edited on 2011-07-19 21:36:16 by PhilDaintree
Additions:
HTML keywords and tags should be in lower case to improve xhtml compatibility.
note that there should be no trailing spaces on the string to be translated inside the _() function call
The only exception to this is that when constructing SQL statements, due to the requirement to single quote string literals in SQL statements, the entire SQL string should always be written using double quotes. (See below)
if ($VariableName == true) echo _('Variable was true');
Whenever a statement block is used code within the block should be one tab indented. Indenting code correctly is critical to avoid logic errors and to imrpove readability.
Deletions:
HTML keywords and tags should be in lower case to improve xhtml compatibility. This has changed since all code was written with (x)html in capitals. The code has many places currently where the html is in upper case - this will be changed over time to lower case.
note that there should be no trailing spaces or punctuation on the string to be translated inside the _() function call
if ($VariableName == true)
Whenever a statement block is used code within the block should be one tab indented.


Revision [2097]

Edited on 2011-07-19 21:25:14 by PhilDaintree
Additions:
The variables $i $j and $k can be used as a counters.
Deletions:
The variable $i can be used as a counter.


Revision [2074]

Edited on 2011-04-06 21:54:52 by PhilDaintree
Additions:
It is a core goal of webERP to be easy to read for business people and newcomers to PHP. This requires some compromises, but mostly much of these standards represent good programming practise and the adoption of conventions which make the code consistently easy to read throughout.
All code in webERP must conform to these standards.
**Function/Class/Variable/Field Naming**
NOTE: Since variables incorporated into an SQL string need to be quoted with single quotes inside the SQL string, the SQL strings themselves need to be quoted inside double quotes.
This is the one exception to the general rule to always use single quotes for strings (which makes the parsing job for PHP easier and quicker).
Deletions:
It is a core goal of webERP to be easy to read for business people and newcomers to PHP. This requires some compromises, but mostly much of these standards represent good programming practise and the adoption of conventions which make the code consistent throughout.
**Function/Class/Variable Naming**
NOTE: Since variables incorporated into an SQL string need to be quoted with single quotes, SQL strings in general need to be quoted inside double quotes. This is the one exception to the general rule to always use single quotes for strings. Where an SQL string has not variables that need to be quoted then single quotes can be used for the whole SQL string.


Revision [2073]

Edited on 2011-04-06 21:48:26 by PhilDaintree
Additions:
It is a core goal of webERP to be easy to read for business people and newcomers to PHP. This requires some compromises, but mostly much of these standards represent good programming practise and the adoption of conventions which make the code consistent throughout.


Revision [2072]

Edited on 2011-04-04 06:20:11 by PhilDaintree
Additions:
Quoting SQL variables - variables incorporated into SQL strings need to be inside SINGLE quotes so that the variable cannot be used by a hacker to send spurious SQL to retrieve private data.
NOTE: Since variables incorporated into an SQL string need to be quoted with single quotes, SQL strings in general need to be quoted inside double quotes. This is the one exception to the general rule to always use single quotes for strings. Where an SQL string has not variables that need to be quoted then single quotes can be used for the whole SQL string.
Deletions:
Quoting SQL variables - variables incorporated into SQL strings need to be inside quotes so that the variable cannot be used by a hacker to send spurious SQL to retrieve private data.


Revision [2049]

The oldest known version of this page was created on 2011-03-25 20:05:47 by PhilDaintree
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki