6.8.6
Local Variable and Parameter Names
NAMES
interface ProcessStates {
int PS_RUNNING = 0;
int PS_SUSPENDED = 1;
}
Hiding involving constant names is rare:
Constant names should be longer than three letters, so that they do not hide
the initial component of a unique package name.
Constant names normally have no lowercase letters, so they will not normally
hide names of packages, types, or fields, whose names normally contain at
least one lowercase letter.
Constant names cannot hide method names, because they are distinguished
syntactically.
6.8.6 Local Variable and Parameter Names
Local variable and parameter names should be short, yet meaningful. They are
often short sequences of lowercase letters that are not words. For example:
Acronyms, that is the first letter of a series of words, as in
cp
for a variable
holding a reference to a
ColoredPoint
Abbreviations, as in
buf
holding a pointer to a
buffer
of some kind
Mnemonic terms, organized in some way to aid memory and understanding,
typically by using a set of local variables with conventional names patterned
after the names of parameters to widely used classes. For example:
N
in
and
out
, whenever some kind of input and output are involved, patterned
after the fields of
java.lang.System
N
off
and
len
, whenever an offset and length are involved, patterned after the
parameters to the
read
and
write
methods of the interfaces
DataInput
and
DataOutput
of
java.io
One character local variable or parameter names should be avoided, except
for temporary and looping variables, or where a variable holds an undistinguished
value of a type. Conventional one character names are:
b
for a
byte
c
for a
char
d
for a
double
e
for an
Exception
110
footer
Our partners:
PHP: Hypertext Preprocessor Best Web Hosting
Java Web Hosting
Inexpensive Web Hosting
Jsp Web Hosting
Cheapest Web Hosting
Jsp Hosting
Cheap Hosting
Visionwebhosting.net Business web hosting division of Web
Design Plus. All rights reserved