This repository has been archived by the owner. It is now read-only.
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
87 lines (59 sloc) 2.08 KB

Best Practice

A best practice is a method or technique that has consistently shown results superior to those achieved with other means, and that is used as a benchmark. In addition, a "best" practice can evolve to become better as improvements are discovered. ~ Wikipedia


  • Document everything. There is no such thing as too much documentation.
  • Don't duplicate the functionality of a built-in library.
  • Don't swallow exceptions or "fail silently".
  • Don't write code that guesses at future functionality.
  • Exceptions should be exceptional.
  • Keep the code simple.



Object-Oriented Design

  • Avoid global variables.
  • Avoid long parameter lists.
  • Limit collaborators of an object (entities an object depends on).
  • Limit an object's dependencies (entities that depend on an object).
  • Prefer composition over inheritance.
  • Prefer small methods. Between one and five lines is best.
  • Prefer small objects with a single, well-defined responsibility. When an object exceeds 100 lines, it may be doing too many things.


  • Prefer MySQL
  • Prefer InnoDB Storage Engine (if using MySQL)
  • Naming DB column titles by separating words with underscores _ e.g. user_id, vendor_id

Web APIs



  • Don't support clients without Javascript.
  • Don't support IE6 or IE7.