Principles
S - Single-responsibility Principle O - Open-closed Principle L - Liskov Substitution Principle I - Interface Segregation Principle D - Dependency Inversion Principle
Types
- Creational
- Structural
- Behavioral
Creational
Simple Factory
Easy object creation. Provide type of extended class depending on use case Example: Button Factory for UI. We need to create button instance, set some properties, id... track creation/destroy if needed
Builder Pattern
Object Creation Readability. Using Constructos is cubersome
Singleton Pattern
Cache Service
Structural Design Patterns
Adapter
Wrapper Classes
Bridge Pattern
Seperation of concerns
Facade
wrapper with helper methods
Iterator
Observer
Visitor
Example: Parsing