About Design Patterns
Definition
Design patterns are typical solutions to common problems in software design. Each pattern is like a blueprint that you can customize to solve a particular design problem in your code.
Benefits of patterns
Patterns are a toolkit of solutions to common problems in software design. They define a common language that helps your team communicate more efficiently.
Pattern classification
- Creational patterns worry about the flexible creation of objects without introducing unnecessary dependencies into the program.
- Structural patterns show different ways of building relationships between objects.
- Behavioral patterns take care of efficient communication between objects.
Design principles
The qualities of good architecture:
- Code reuse.
- Extensibility.
Basic design principles:
- Encapsulate what is changing. Identify the aspects of a program, class, or method that change most often, and separate them from what remains constant.
- Program at the interface level, not at the implementation level. The code should depend on abstractions, not specific classes.
- Prefer composition to inheritance.