Coding Starndard for Team Project


Coding Standards

Don’t dare to be different.  Conformity makes it easier for others to figure out your code.

Naming:

Java style Camel Code Naming is preferred: Multiword names are concatenated with no space or “_” but each new word is capitalized.  For classes first letter is capitalized,   For methods and variables first letter is lower case.  Use names that are clear and identify what the class, function or variable is used for.  Examples “AClassName,” “aMethodName,” “aMemberVariable.”

Comments:

Use Java Doc Style Comments and Headers.  This includes a comment block above each class or method with a clear description of what it is for and key attributes listed with standard naming such as “@author.”  This allows automatic generation of reference documents from the comments in the code.  Additional standards cover member variables etc.  See http://en.wikipedia.org/wiki/Javadoc and links below for more.

Organization:

Use short functions and methods grouped in small files as much as possible.  Use packages and a hierarchical directory structure for more complex projects.  This kind of organization should naturally follow from an object oriented design where different logical components are encapsulated in their own classes and files.  Java has many good examples.

Code Reuse:

Use common class libraries where ever possible.  A good example is the Java or C++ collections classes that come standard with the languages.  Java has a huge set of standard libraries.  Third party libraries can also be used for Java and other languages.

Architecture:

Use popular or common design architectures such as Model View Controller or its common variants.  This insures that the over all structure of your code is familiar to other programmers and can more easily integrate with the work of others.

Design:

Use other existing projects as examples and models.  Try to follow standards or default standards established by dominant products.  Make your UI instantly familiar and easy to use.

 

Copyright

Please paste the following lines at the top of your source code file

-----------------------------------

Copyright © 2012 The Regents of the University of CaliforniaAll Rights ReservedInformation Retrieval and Knowledge Management LabUniversity of California Santa Cruz
Created by *** (your name)

Last modified by ***  (name & time)

Last approved by *** (name & time)

-----------------------------------------------


Links:

Rather than rewrite the book on coding standards here are some links to useful documents:

http://www.possibility.com/Cpp/CppCodingStandard.html
http://en.wikipedia.org/wiki/Programming_style
http://www.sitepoint.com/coding-standards/
http://www.extremeprogramming.org/rules/standards.html
http://g.oswego.edu/dl/html/javaCodingStd.html
http://en.wikipedia.org/wiki/Javadoc
http://javaworkshop.sourceforge.net/chapter4.html
http://www.python.org/dev/peps/pep-0008/
http://bayes.colorado.edu/PythonGuidelines.html
http://en.wikipedia.org/wiki/Model-view-presenter
http://www.ibm.com/developerworks/library/os-php-designptrns/
http://en.wikipedia.org/wiki/Service-oriented_architecture
http://www.webbizdesigns.com/web-architecture
http://apparchguide.codeplex.com/wikipage?title=Chapter%2015%20-%20Web%20Applications