The composite design pattern is intended for structuring data classes with a relationship to each other. It categorizes the data as either a composite- or and leaf class, which determines whether other classes can be stored within the class. For this reason, it should come as no shock that it is a structural design pattern.
🛠 Design Patterns
A collection of the most popular design pattern tutorials made by INTEGU. The tutorials include everything from theory, practical examples, videoes, class diagram, and code snippets.
The Builder Pattern helps separating the construction of complex objects from the context where they are needed. Additionally, the pattern also contains different variations of objects which have a common construction procedure.
This makes the builder pattern convenient to use when complex objects needs to be created and well aligned with the Single Responsibility Principle. (SRP)
Given that the builder pattern sets up a method for constructing new objects, it is understandably categorized as a creational design pattern.
As arguably the most popular creational design pattern, the factory pattern provides guidelines for how to flexibly and conveniently create different objects with the same method, by only changing the method’s argument. Utilizing the factory pattern in the creation of objects allows all complexities of the creation to be hidden away. Simultaneously the factory can be designed to create any variation of an object, as long as all objects extend from the same super-class.