Difference between revisions of "Coding guidelines"

From SIMA wiki
Jump to: navigation, search
Line 38: Line 38:
 
  g ... generic
 
  g ... generic
 
   ... to be continued
 
   ... to be continued
 +
 +
 +
== File notation (java/eclipse) ==
 +
 +
clsXYZ          ... Classe Files
 +
XYZ              ... Class Files that contain the method //public static main(String args[])// and that are meant to be used to start the application
 +
itfXYZ          ... Java Interface
 +
tstXYZ          ... junit Test Cases
 +
tssXYZ          ... junit Test Suites

Revision as of 12:59, 16 October 2012

General Conventions

  1. Comment your code (documentation_guidelines)
  2. One File - One Class
  3. Don't add packages with a wildcard (e.g. java.lang.* - instead always type the whole package name java.lang.Integer)
  4. Produce readable code
  5. Produce efficient code (in this order - first readability, then efficiency)

Naming Conventions

camel case + (reduced) hungarian notation = ARS coding guidline

example camel case: clsHeimoZeilinger (new word –> capital letter)

example hungarian: mnCountOfHeimos (m for member, n typeof integer)

Origin: notation - Wikipedia


Basics in (reduced) hungarian notation:

1st letter:

     m ... member
     p ... method parameter
     i ... interface parameter
     s ... static variable
 blank ... function scope
       ... to be continued


2nd letter:

b ... boolean
e ... enum
n ... number (integer, long)
r ... real (floating point, double)
o ... object (also string)
g ... generic
 ... to be continued


File notation (java/eclipse)

clsXYZ           ... Classe Files
XYZ              ... Class Files that contain the method //public static main(String args[])// and that are meant to be used to start the application
itfXYZ           ... Java Interface
tstXYZ           ... junit Test Cases
tssXYZ           ... junit Test Suites