Discipline
In order to effectively work, we need a discipline to ensure all work is of a certain standard and constant.
While developing pDinah, the following discipline should be adhered to:
- Variable and function names in CamelCase.
- Definitions in all-caps, with underscores to replace spaces (or separate words).
- Code must be properly indented, see example.
- Classes should be kept in their own files, within the Class directory (located in lib) - see Structuring.
- All files should be documented in the appropriate MANIFEST file.
- Any modifications made should commented, see example.
- If a module has multiple script or template files, an appropriate directory should be created to contain them.
Example Code
<?php
/**
* lib/Class/SQL.php [pDinah]
* ==================================================
* @author: Ploy
* @created: 25/04/2008
* --------------------------------------------------
* @modifier: Ploy
* @modified: 25/04/2008
* @desc: Initial code.
**/
class SQL extends pDinah {
/*
* Description of function goes here.
*/
public static function GetInfo($String)
{
static $Db;
if(isset($Db)) {
return $Db;
}
/*
* Modified on 25/04/2008 by Ploy - Added SQL connect.
*/
$Db = mysql_connect(SQL_HOST,SQL_USER,SQL_PASSWD);
$Link = mysql_select_db(SQL_DBNAME);
return $Db;
}
}
?>
