Difference between revisions of "Developers Standards"

From Zen Cart(tm) Wiki
Jump to: navigation, search
m (Indentation)
m
Line 1: Line 1:
 
{{Template:menuBarDevelopers}}
 
{{Template:menuBarDevelopers}}
  
Zen Cart Coding Standards
+
Zen Cart™ Coding Standards
 
Currently I am using a mix of the pear/phpBB coding standards docs to provide the categories as below.   
 
Currently I am using a mix of the pear/phpBB coding standards docs to provide the categories as below.   
  
 
BTW, the coding standards posted here are what we strive for. They are not a definition of how code is currently written.  
 
BTW, the coding standards posted here are what we strive for. They are not a definition of how code is currently written.  
So if the code you get, does not match posted standards, don;t be suprised. Its a long and ardous battle to convert all core code.  
+
So if the code you get does not match posted standards, don't be suprised. Its a long and arduous battle to convert all core code.
 +
 
 
== Indentation ==
 
== Indentation ==
  

Revision as of 07:32, 28 April 2006

Zen Cart™ Coding Standards Currently I am using a mix of the pear/phpBB coding standards docs to provide the categories as below.

BTW, the coding standards posted here are what we strive for. They are not a definition of how code is currently written. So if the code you get does not match posted standards, don't be suprised. Its a long and arduous battle to convert all core code.

Indentation

Currently, the standard is not to use hard tabs, and to use 2 spaces per indent.

My thoughts are this, regardless of whether you use tabs or spaces for indents, anything more than 2 spaces can quickly lead to indent hell. the argument then becomes whether indents should be hard tabs or soft spaces.

I have to say I prefer soft spaces...unless someone can come up with a convincing argument otherwise,(this is mainly because the tab /t can be interpreted differently across OS's and editors, whereas a space is always interpreted the same whatever.

Control Structures

Function Calls

Function Definitions

Comments

Including Code

PHP Code Tags

This is fairly simple, nver use short open tags <? or asp tags <%

Always use th full <?php ?> tags

Header Comment Blocks

Example URLs

Naming Conventions

Variable Names

Function Names

Class Names

Code Optimisations

SQL/SQL Layout

File Locations

Miscellaneous