Simple project representing the composite design pattern. For this one i've created a code that represents a book and its chapters.
Composite is a structural design pattern that lets you compose objects into tree structures and then work with these structures as if they were individual objects.
The composite pattern describes a group of objects that are treated the same way as a single instance of the same type of object. The intent of a composite is to "compose" objects into tree structures to represent part-whole hierarchies. Implementing the composite pattern lets clients treat individual objects and compositions uniformly.
Composite should be used when clients ignore the difference between compositions of objects and individual objects.[1] If programmers find that they are using multiple objects in the same way, and often have nearly identical code to handle each of them, then composite is a good choice; it is less complex in this situation to treat primitives and composites as homogeneous.
Source: Wikipedia | Refactoring Guru