In general, classes with too many responsibilities should be broken up into component classes, each with a smaller set of responsibilities (Break up classes with too many responsibilities, page 149 (7th ed.) or 168 (8th ed.)). Each new class created has to be stored in some package (Addition of a Class into a Package, page 137 (7th ed.) or 155 (8th ed.)).
It may not release resources quickly enough (Object Destruction and the
finalize
method, page 135 (7th ed.) or 152 (8th ed.)). The JVM guarantees only that
the finalize method is called before a class instance is garbage collected.
Scarce resources soon should be recovered soon after the class instance holding
them becomes garbage, or, even better, once the resources are no longer needed,
independent of whether or not the associated class instance is still valid.
This page last modified on 31 March 2008. |
|