Navigation:  "The Jet Engine" PHP Application Framework > Creating a Jet Engine Application >

Coding Conventions

Previous pageReturn to chapter overviewNext page

Every file shipped with your module (except for the config and menu json files) must be coded in php, and must adhere to the following standards:

 

All files must all compile without errors or warnings

 

General Coding Conventions:

Some core coding conventions are listed below for you to follow in keeping your code readable and maintainable by the masses.  Also refer to the official perl manual of style: http://www.perldoc.com/perl5.6/pod/perlstyle.html

 

4 space indented loops and routines

Use 4 spaces to indent everything that needs it. DO NOT USE TABS !

 

Use this:

function foo() {

   [code in here, indented]

}

 

Not this:

 

sub foo {

[code in here]

}

 

Proper bracket placement

Where possible, keep your loops on a single line.  Otherwise, open your loop bracket on the same line as the loop statement, and line up the closing bracket with the opening statement.  Use a space between each element for readability.

 

Preferred:

       if ( $this eq $that ) { &do_this; }

 

OK:

       if ( $this eq $that ) {

           &do_this;

       }

 

Ugly:

       if ( $this eq $that )

       {

           &do_this;

       }

 

Core Object Usage

Where possible, use the built-in object methods provided to access the Environment or SQL Databases.  ($jet / $templates / $config / $iSQL / $oSQL)

These objects were designed, and are available to provide an easy interface for you, as well as being highly optimized for speed and accuracy.  Remember, all of the hard work (and ugly details) have been done for you...

 

Comments, Comments, Comments !!

Be excessive in your commentary throughout your code.  Chances are, you wont be the only person that ever needs to read it.

 

 


 

 


This help file was created with an unregistered evaluation copy of Help & Manual. © EC Software. All rights reserved. This message will not appear if you compile this help file with the registered version of Help & Manual.