CodingStyle

PEAR Coding Standard

But we're not religious about that...
http://pear.php.net/manual/en/standards.php

Class names reflect directory location

The __autoload stuff only works, if the classname is equal the Directory + Filename.
Therefore the class bx_plugins_foobar has to be placed in _BX_INC_DIR.'bx/plugins/foobar.php' _

(of course, if you include_once the class before you call it, it doesn't matter where the class is. But this approach is not advised in our framework. It makes finding the right classes more difficult)

Static Methods for creating instances of classes

It doesn't make sense every time, so it's not a must, but preferable..

Pro:

  • Changing of constructor signature possible
  • Multiple different "constructors" possible
  • Changeing from singleton to non-singleton or caching (or vice versa) possible

Minimize public API, seperate API and implementation

use the new PPP functionalityof PHP5

Use Interfaces instead of Abstract Classes

Multiple Interfaces are possible, multiple inheritance isn't

Use interfaces, not classes for type hints

It's much more flexible...

Use lowercase fieldnames and tablenames for more compatibility

  • MDB2 per defaults lowercases everything.
  • Windows and Macs have case-insensitive table names in MySQL ('cause of filesystem limitations)

Labels:

Enter labels to add to this page:
Wait Image 
Looking for a label? Just start typing.