The following factors influence decompostion, often in conflicting ways. You may inherit functions that are not appropriate in the new class. Addvantages of Composition Object composition is defined dynamically at runt-time through objects acquiring refernces to other objects. Composed objects don't violate encapsulation. Fewer interface dependencies.
Class hierarchies remain small.
How to Select a Design Pattern With more than 20 design patterns in the catalog to choose from, it might be hard to find the one that addresses a particular design problem, especially if the catalog is new and unfamiliar to you. Section 1.6 discusses how design patterns help you find appropriate objects, determine object granularity, specify object interfaces, and several other ways in which design patterns solve design problems. Referring to these discussions can help guide your search for the right pattern. Scan Intent sections. Read through each pattern's intent to find one or more that sound relevant to your problem.