|
| |
Good Programming Practices
- Familiarize yourself with the rich collection of classes and methods in
the Java API and with the rich collections of classes available in various
class libraries.
- Place a blank line between method definitions to separate the methods and
enhance program readability.
- Although it is not incorrect to do so, do not use the same names for the
arguments passed to a method and the corresponding parameters in the method
definition. This helps avoid ambiguity.
- Choosing meaningful method names and meaningful parameter names makes programmes
more readable and helps avoid excessive use of comments.
- Use only uppercase letters (with underscores (_) between words) in the
names of final variables. This makes these constants stand out in a program.
- Using meaningfully named final variables rather than integer constants
(such as 2) makes programmes more readable.
- Avoid local variable names that hid instance variable names. This can be
accomplished by avoiding the use of duplicate identifiers in a class.
- Overloading methods that perform closely related tasks can make programmes
more readable and understandable.
Source: Deitel, H.M. and Deitel P.J. Java: How to
Program. 3rd ed. Upper Saddle River, New Jersey. Prentice Hall.1999. ISBN
0-13-012507-5, p 253.
|