Principles
Design patterns
In laymen terms, Design Patterns are the solutions to commonly occurring problems in software design. These patterns are easily re-usable and are expressive. Some types include creational, structural and behavioral.
Creational patterns are meant to create objects instead of instantiating them directly, this includes Singleton, Prototype, Builder and Factory patterns.
Structural which concerns class and object composition. They use inheritance to compose interfaces, which includes Decorator, Adapter, Bridge, Facade and Proxy patterns.
Behavioral are specifically concerned with communication between objects, among which we have Iterator, Observer, Mediator and State patterns.
Examples
- Facade: A simplified API to hide low level details in a codebase.
- Proxy: substitutes an original object with another.
- Singleton: A type of object that can only be instantiate once within the codebase. An example is settings, or a database connection, and it can be represented by a class or a simple object.