WIKINDX ~ Coding conventions for version 2

With more than one developer, a coding convention is required to aid in readability and understanding. This relates to the naming of variables, functions and classes and methods in addition to structural matters.

All PHP code must be compatible with PHP >= v4.3.10 as this, currently, seems to be the most common PHP install. This may change in future now that PHP 5 is out.

NAMING REQUIREMENTS:

1/ All variables and functions/methods must be a mix of lower and upper case, should be designed to be self-documenting and will scan in English (usually starting with a verb). For example, a class method that grabs the resource's title from the database should be named something like:

	getResourceTitle()
and not
	resourceTitleGet() (doesn't scan in English)
or
	grabTitle() (has only a partial sense)
or
	get_resource_title() (unnecessary length)
or
	fuchsia() (means nothing)

Variables that can be exceptions to this are:
a) transitory and throwaway variables as you might find briefly used in for() loops and
b) WIKINDX configuration variables which must be uppercase, start with $WIKINDX_ and have a descriptive name.
For example:
	$WIKINDX_DB_PASSWORD
and not
	$WIKINDX_PWDDB

2/ All WIKINDX classes must be uppercase (for example SQL.php), while non-class PHP files must be lowercase (for example index.php). Within a class, the class name (one only) and constructor name will be uppercase. For example, SQL.php will have a SQL{} class and, within that, a SQL{} constructor.

3/ Groups of classes having a common theme are placed in a descriptive lowercased folder within the classes folder.

4/ When including files use the full path. Some ISP configurations will not find the include file without it. e.g.

	include_once("core/sql/adodb.inc.php");
	and not
	include_once(adodb.inc.php");

Comment your code!

WIKINDX home