
Coding rules
Nima Chitgar
1. Use singular nouns or noun phrases as names for classes. Use Pascalcase casing for their
spelling.
2. A class documentation comments start with an enumeration of all the characteristics ascribed
to the class itself, as well as all the characteristics ascribed to the individual objects of that
class.
3. Include at least a version number (@version) and a list of author names (@author) in the
class documentation comment.
4. User verbs or verbs phrases in active tense as name for methods. Use camelCase for their
spelling.
5. Choose method names in such a way that their invocations read as commands or questions
in a natural language.
6. Start the definition of a class with a definition of all its constructors.
7. Group all elements of a class related to a single property
. Start a group with its public
elements; finish with its private elements.
8. Introduce a getter and setter for each single-valued, mutable property. Introduce a getter for
each single-valued, immutable property.
9. Do not define a method that at the same time changes the state of some of the objects
involved in it, and returns a result.
10. Inspectors never change the observable state of any object.
11. Mutators never return a result.
12. In a group of elements related to a single property, inspectors precede
mutators with the
same access right.
13. Prefer instance methods
.
14. Use a static method if only primitive
values are involved in it.
15. Use class methods if their behavior must at all times be the same for all the objects of a class.
Use class methods among other to manipulate class properties.
16. Use singular nouns or noun phrases as names for formal arguments and local variables. Use
camelCase for their spelling.
17. Start documentation comments attached to methods with a one line summary of the method’s
semantics
18. Clarify in a method’s documentation the role of each formal argument in a clause head by
the predefined tag @param.
19. Introduce basic inspectors to get the current value of each property ascribed to classes and
their objects, and add the annotation @Basic to their definition.
Come before something in time
Method that belongs to a class rather than an instance of a cl ass
Undefined, null, boolean, string and number