forked from extern/egroupware
Updated doc
This commit is contained in:
parent
90eacf1b15
commit
c1f7e245d5
@ -1,16 +1,22 @@
|
||||
1) Format your code so that we can read it. Please!
|
||||
2) Use tabs for formating. NOT SPACES. Tabs creates smaller files and editors allow developers to view a tab as however many spaces as they prefer. Spaces do not allow this.
|
||||
3) Use ' instead of " for strings. This is a performance issue, and prevents alot of inconsistant coding styles.
|
||||
4) Comments go on the line ABOVE the code. NOT to the left of the code!
|
||||
5) For each section of code put a section divider with basic explaination of the following code/functions.
|
||||
2) Use tabs for formating. NOT SPACES. Tabs creates smaller files and editors allow
|
||||
developers to view a tab as however many spaces as they prefer. Spaces do not allow this.
|
||||
3) Use ' instead of " for strings. This is a performance issue, and prevents alot of inconsistant
|
||||
coding styles.
|
||||
4) Comments go on the line ABOVE the code. NOT to the right of the code!
|
||||
5) For each section of code put a section divider with basic explaination of the following
|
||||
code/functions.
|
||||
|
||||
It should look like this:
|
||||
/****************************************************************************\
|
||||
* These functions are used to pick my nose *
|
||||
\****************************************************************************/
|
||||
|
||||
6) Do not document every bit of code in comments. PHP is an interpreted language and it will be nasty on performance
|
||||
6) Do not document every bit of code in comments. PHP is an interpreted language and it will be
|
||||
nasty on performance
|
||||
|
||||
7) Use switch statements where many elseif's are going to be used. Switch is faster and I like it better!
|
||||
7) Use switch statements where many elseif's are going to be used. Switch is faster and I like it
|
||||
better!
|
||||
8) If statement need to follow the following format
|
||||
|
||||
if ($var == 'example')
|
||||
@ -25,10 +31,19 @@ It should look like this:
|
||||
Do NOT make if statements like this
|
||||
if ($var == 'example'){ echo 'An example'; }
|
||||
|
||||
All other styles are not to be used. This is it. Use it or I will personally come and nag you to death.
|
||||
All other styles are not to be used. This is it. Use it or I will personally come and nag you to
|
||||
death.
|
||||
|
||||
9) ALL if statements HAVE to have match { }
|
||||
Do NOT create if statements like this:
|
||||
if ($a == b)
|
||||
dosomething();
|
||||
or:
|
||||
if ($a == b) dosomething();
|
||||
|
||||
9) class/function format
|
||||
They make the code more difficault to read and follow
|
||||
|
||||
10) class/function format
|
||||
class testing
|
||||
{
|
||||
function print_to_screen()
|
||||
@ -48,4 +63,33 @@ All other styles are not to be used. This is it. Use it or I will personally com
|
||||
|
||||
Notice that when defining a class we break from the norm (putting } on same line as statement) and move the { to the next line. Dont ask me why, but this is what I/we do.
|
||||
|
||||
This is all I have got for now.
|
||||
11) Arrays must be written in the following way
|
||||
$array = array(
|
||||
'var' => 'value',
|
||||
'var2' => 'value2'
|
||||
);
|
||||
|
||||
Spaces are permitied between the => 's
|
||||
|
||||
12) Use the long format for <?php do NOT use <?
|
||||
13) All code should start with 1 tab example:
|
||||
|
||||
<?php
|
||||
dosomething();
|
||||
if ($a)
|
||||
{
|
||||
dosomemorestuff();
|
||||
}
|
||||
|
||||
NOT
|
||||
|
||||
<?php
|
||||
dosomething();
|
||||
if ($a)
|
||||
{
|
||||
dosomemorestuff();
|
||||
}
|
||||
|
||||
14) Use lower case for variable and function names. No stubly case code
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user