Coding Standards
Home >> Computing >> Coding Standards

Coding Standards




Java Coding Standards

  1. Naming Conventions
    1. Class names
    2. Method names
    3. Variable names
    4. Constant variable names
    5. Package names
  2. Code Appearance
  3. Javadoc comments
  4. Comments ( inline documentation )
  5. Always comment bug fixes
  6. A method should perform one and only one concrete function
  7. Predicate methods
  8. Always initilize variables
  9. Accessor and mutator methods
  10. Referencing instance variables using the this keyword
  11. Inner classes
  12. Place variables on the right side of relational operators
  13. Static Methods
  14. Primitive types vs. objects
  15. Alternatives to Hard-Coding Values

JavaScript Coding Standards

  1. What JavaScript should be used for
  2. Naming Conventions
  3. Code Appearance
  4. Form Referencing
  5. Netscape vs Internet Explorer

HTML Coding Standards

  1. A note about HTML editors
  2. Make the web site available to as wide an audience as possible
  3. Be a minimalist
  4. Be mindfull of the seven plus or minus two rule
  5. Thou shalt not use the BLINK tag
  6. Don't be afraind to place an element in more than one location
  7. Easy navigation
  8. Include author and/or owner information on every web page
  9. Scrolling
  10. Don't put vast amounts of HTML markup on one line
  11. Don't overuse whitespace
  12. Pick a case for tags (and stick with it)
  13. Don't use tags that STADN (sit there and do nothing)
  14. Terminate all tags
  15. Enclose tag attribute values in quotes
  16. Use colour names instead of RGB values
  17. Don't change link colours or decoration
  18. Avoid using too many large images
  19. Do not use cheesy custom bullets or line-separators
  20. Avoid using background images
  21. Linking to Other Pages

Appendix A : HTML Colours

Appendix B : References


This document is a rewritten and very much expanded version of a coding standard I co-authored with Roneel Achal in 1999. Since that time, my knowledge and level of experience have increased; thusly I was able to include significantly more material in this new version. This document has increased in length by a factor of 6 over the original version that Roneel and I composed long ago.

It should also be noted that Darren Holloway directly contributed some excellent material to this coding standard. Mr. Holloway's contributions would include the sections [in the Java standard] entitled always comment bug fixes and place variables on the right side of relational operators.


A friend once remarked that only rich people can afford poor programmers. This comment indicates the long known truth that poor initial coding and/or design ensures that a piece of software will be expensive and built to stay that way! Software historically incurs much of its cost in the maintenance phase of its life - the part that happens after the system has been created and deployed. Hence if one endeavours to build systems with a low overall lifetime cost one must strive to get it right the first time. One way to achieve this lofty goal is to have a simple set of standards that developers must adhere to; the standards must be simple or they won't be used.

These coding standards are intended to establish a set of guidelines one should follow when coding anything webbish. The content of these coding standards outlines a set of best practices. It has been demonstrated that the use of these guidelines and best practices provide more robust code that has a lower lifetime cost.

It is assumed that the reader has knowledge of both object oriented and procedural programming using the languages Java, Perl and JavaScript. It is also assumed that the reader is very comfortable with HTML in its various guises. This guide should not be used as a tool for learning one of the aforementioned languages.

In instances where the coding standard is unclear, one should consult a senior developer (if possible). One should then inform the author of the lack of clarity in the standards so that they may be improved.

Copyright © Dan Hay
Last update: Wednesday, 16-Nov-2005 06:00:59 UTC