Coding Standards

Standards are a major indicator of Software Quality

Coding Standards play an extremely important role in building quality software. By adhering to a pre-defined set of standards, developers are able to understand, adopt, and interact with the work built by other members of the team. Conformance to standards promotes interoperability between projects, and allows for easier transitions when a developer is new to the team.

 By far the biggest cost in any project is fixing and maintaining the code, not developing it in the first place. So:

  • Think about users of your class and put yourself in their mind state when writing comments and documentation.
  • Design for understandability and maintainability.
  • Remember that complexity is the number one enemy of maintainability.
  • Less is more!

Commenting and Structure

Proper Comments and Structure make code much easier to read, which is not only important for peer reviews and audits, but later when code is inherited by other developers.

 Comments

  • Classes, Triggers and other code based objects should begin with a comment section that describes the purpose of the file, the author, and revision history
  • Methods and Functions should begin with a short comment about the purpose of the method of function
  • Input or output variables which are not obvious should have a comment descriptor
  • Comments should be short yet concise
  • Utilize a Template, which includes generic comments and sections when possible.  Modify the comments as needed.

Structure

  • Curly braces should begin and end on a new line after a control statement, except for short, single lines of code
  • Code within curly braces should be indented to the next level
  • Refer to "Allman Style" for structural guidance
© 2014 Dean Abraham