- Class Name starts with uppercase and every new word is capitalized
i.e
Vertex, NewClass, ...
. - Function Name starts with lowercase and every new word is capitalized
i.e
foo, fooName, ...
. - Comments: You must write a description before defining a Class or a Function.
- For Allah You have to write a comment line before every line of code you write.
- We use Spaces not Tabs,
1Tab = 4Spaces
. - Always write a multi-line comment to test you code.
- A line Must not be more than 80 column.
/**
* Describe what fooWord() does.
* Describe the arguments.
* Preconditions.
* PostConditions.
**/
public void firstSecond ( argu1, argu2, ... ) {
// What does the next line do.
int x = 1 + 2
.
.
.
} // end fooWord()
/**
* Describe the class
* Tell about any
* ...
* etc
**/
public class myClass {
} // end class myClass
- Any control statment
if, while, for, ...
follows this pattern (Multi-comment before it, comment after the end curly brace, comment before any line)
This helps everyone to read and maintain the code even when you're maintaining someone else code