|
|
|
| |
 |
Use nested classes
If two classes are associated with each other in some functional way (such as containers and iterators), try to make one an inner class of the other. This type of nesting of one class within another not only emphasizes the association between the classes, but it allows the class name to be reused within a single package. The Java containers library does this by defining an inner "Iterator" class inside each container class, thereby providing the containers with a common interface.
Bruce Eckel is a frequent author and lecturer on software development practices and was a founding member of the ANSI/ISO C++ committee. The information contained in this article is excerpted from his latest book, "Thinking in Java: Second Edition" (Prentice Hall, 2000). Reach him at Bruce@EckelObjects.com.
|
Java Zone - Get Help - Search
Tips
|
|
 |
Save on Hot Java Specials
|
SOFTWARE:
dtSearch Web
Add power searching to your web site. Buy Now! |
BOOKS:
PointBase Mobile Edition
Enable local data access for mobile users. Buy Now! |
|
 |
|