What is a design pattern?
Design patterns are solutions to commonly occurring problems in software design. Design pattern is not code - rather, design patterns act as a guide or paradigm to help software engineers create products following best practices.
History of patterns
Design patterns are not obscure, sophisticated concepts - quite the opposite. Patterns are typical solutions to common problems in object-oriented design. When a solution gets repeated over and over in various projects, someone eventually puts a name to it and describes the solution in detail.
famous books
- A Pattern Language: Towns, Buildings, Construction (Center for Environmental Structure Series)
- Design Patterns: Elements of Reusable Object-Oriented Software
Why should learn patterns?
Design patterns are a toolkit of tried and tested solutions to common problems in software design.
Design patterns define a common language that you and your teammates can use to communicate more efficiently.
Proven Solution
Software developer does not have to reinvent the wheel when that problem occurs.Reusable
Design patterns can be modified to solve many kinds of problems - they are not just tied to a single problem.Expressive
Design patterns are an elegant solution.Prevent the need for refactoring code
Since the design pattern is already the optimal solution for the problem, this can avoid refactoring.Lower the size of the codebase
Each pattern helps software developers change how the system works without a full redesign. Further, as the "optimal" solution, the design pattern often requires less code.
Classification of patterns
Design patterns differ by their complexity, level of detail and scale of applicability to the entire system being designed. Design patterns can be broken down into 3 types.
- Creational patterns provide object creation mechanisms that increase flexibility and reuse of existing code
- Structural patterns explain how to assemble objects and classes into larger structure, while keeping structures flexible and efficient
- Behavioral patterns take care of effective communication and the assignment of responsibilities between objects
Creational patterns
- Factory Method
- Abstract Factory
- Builder
- Prototype
- Singleton
- Object Pool
Structural patterns
- Adapter
- Bridge
- Composite
- Decorator
- Facade
- Flyweight
- Proxy
Behavioral patterns
- Chain of responsibility
- Command
- Iterator
- Mediator
- Memento
- Observer
- State
- Strategy
- Template method
- Visitor
Top comments (0)