Coding standards and good practices

Jaws 2 uses the PEAR coding standard with some exceptions and additions that are documented in this page.

Coding standards

  • Since Jaws 2 is meant for PHP 6, the encoding of each source file will be UTF-8
  • Private methods do not need the preceeding '_' characters
  • Each file must be created using the standard HEADER file which can be found in the devdoc directory in the source

Commit messages

Commit messages are of outmost importance in collaborative development and, as such, they should be very descriptive. If a change in the documentation is needed after the commit, the description of the change in the commit message should be preceded by the [DOCCHANGE] tag.

Style

  • All the internal Jaws classes must be preceded by Jaws_. Each section is separated by '_'
  • Make uses of assertions as most as possible (where applicable)
  • Unless it is not necessary, the type of arguments provided to a method must be checked with assertions to avoid programming errors

Documentation

Documentation is not highly encouraged; it is mandatory.

Methods

  • Each class method must at least have the following elements: @access, @return and @since
  • If the method has parameters, a list of them should be made with @param
  • @final and @static are to be used if the methods are final or static
  • Each class implementing a function from an interface or an abstract function has to cite the prototype with a @see element

Class properties

  • All class properties must be documented with the @var and @access elements

< Click here to go back to Jaws 2 section