What are Design Patterns?
A Design Pattern is a recurring solution to a recurring problem in a specific context. Patterns are not a specific to Software engineering. They are applied
in many disciplines including but not limited to Construction, Mechanical Engineering and psychology. The first book on patterns was written by Christopher Alexander in 1977 on building architecture.“A pattern describes a problem which occurs over and over again in our environment, and then describes the core of the solution to that problem, in such a way that you can use this solution a million times over, without ever doing it the same way twice.” - Christopher Alexander
Design Patterns is the first book on software design patterns written by Gang of Four (Erich Gamma, Richard Helm, Ralph Johnson, and John Vlissides) or GoF. This book describes 23 common design patterns (Gamma et al, 1995). All of these 23 design patterns are explained in your text book.
Design patterns have 4 essential elements:
- Pattern name: increases vocabulary of designers
- Problem: intent, context, when to apply
- Solution: UML-like structure, abstract code
- Consequences: results and tradeoffs
- Creational patterns: Deal with initializing and configuring classes and objects
- Abstract Factory, Builder, Factory Method, Prototype, and Singleton
- Structural patterns: Deal with decoupling interface and implementation of classes and objects Composition of classes or objects
- Adapter, Bridge, Composite, Decorator, Facade, Flyweight, and Proxy
- Behavioral patterns: Deal with dynamic interactions among societies of classes and objects How they distribute responsibility
- Chain of Responsibility, Command, Iterator, Interpreter, Mediator, and Memento
Comments
Post a Comment