| < Day Day Up > |
|
This chapter has looked at different methods of reuse. If no state needs to be saved, then procedural reuse, creating a method, works fine; however, if a state must be saved for the reuse, then some form of object reuse is necessary. Object reuse means that a class definition must be implemented so that an object can be instantiated to store the state. If the only purpose of the object is to provide for reuse, then the object is called a utility object. The two ways to implement object reuse are composition and classification. If the object that is providing the reuse is a utility object, then the only consideration regarding how to design the object is to make the properties of the object available. If this is true, then composition is preferred over classification, as composition designs generally have higher cohesion and lower coupling.
| < Day Day Up > |
|