Java Reference
In-Depth Information
Our naming conventions go as follows:
OurClass - class names use concatenated words with the first letter of each word
upper case.
ourMethod () - non-private methods use concatenated words with first letter lower
case and the first letter of each subsequent word upper case.
a - priv - method () - private methods use lower-case words separated by - .
fOurInstanceVar - member variables start with “f (for field) and consist of con-
catenated words with the first letter of each word uppercase.
our - local - var - local variables are in lower case with the words separated by - .
fOurStaticVar - - static variables begin with “f like member variables but end
with two - characters.
javatech.pack - package names use lower case.
A - CONSTANT - VAL - constants are upper-case words separated by - .
Our interfaces are distinguished from classes by appending “Ifc or “able .
We use javadoc comments before each class and method (unless they are short
and obvious). We terminate them with “**/ for symmetry with the “/** that
must start a javadoc comment.
The sample code shown below illustrates the code styling we use for the
remainder of this topic. Each distinct code section, such as a method or an
if-else statement, is indented to the right from the section in which it is
nested. All primitive variables are initialized explicitly. (Default values would be
assigned automatically but by initializing them you make clear that the values
given are what you intended for those variables.) For the class definition and
for long methods we put the name in a comment after the final brace. (We use
“// ctor for long constructors.)
// Non javadoc comments, authorship, and
// class development history.
package javatech.xxx.yyy.zzz;
import java.io.*;
/** javadoc comments about the class. **/
public class SomeClassName
{
int fInstanceVal = 1;
double fVal = 0;
Integer fInstanceRef;
public SomeClassName {
... constructor code ...
} // ctor for longer constructors
 
Search WWH ::




Custom Search