Style Guide

Coding Style

Solar classes adhere to the PEAR coding standards, with one minor deviation. In PEAR, only private elements have an underscore prefix; in Solar, both private and protected elements have an underscore prefix.

<?php
public    $public;
protected $_protected; // in PEAR, this would be $protected instead
private   $_private;
?>

Problem-Solving Style

In every Solar class, we strive for simple, easy-to-test, and easy-to-explain solutions. We want fast execution, but prefer to err on the side of slower-but-simpler instead of faster-but-obtuse.

When obtuse or complex code is unavoidable, it is thoroughly commented and outlined with inline narrative comments as a teaching exercise. We know that some poor guy is going to have to figure out how the code works, so we take a little extra time and comment so that others can comprehend what's going on.

Inline Documentation

Solar uses PHP Documentor documentation blocks for every class, property, and method. This makes it easy to auto-generate class documentation.

The inline documentation uses Solar wiki-style markup so that the generated class documentation is automatically linked and styled.

 
manual/project_standards/style_guide.txt · Last modified: 2008/08/25 08:48 (external edit)