Basics
What is a Design pattern?
Design patterns are the best formalized practices a programmer can use to solve common problems when designing an application or system.
Why do we need them?
Design patterns can speed up the development process by providing tested, proven development paradigms.
Reusing design patterns help prevent subtle issues that cause major problems, and it also improves code readability for coders and architects who are familiar with the patterns.
It provides vocabulary, so that the developer can communicate the problem statement and their solutions.
Gamma Categorization
The notion of design pattern was introduced by Gang of Four book, and as per the authors the design patterns are categorized as follows,
Creational
Deals with construction of object.
Provides with explicit (constructor based) and implicit (DI and reflection) ways.
Whole (Single statement) versus piecewise (step by step) construction.
This gives the program more flexibility in deciding which objects need to be created for a given case.
Patterns
Abstract Factory
Builder
Factory Method
Prototype
Singleton
Structural
They use inheritance to compose interfaces and define ways to compose objects to obtain new functionality.
Many patterns provides ways to mimic the underlying class' interface.
Important is given on creating good API design.
Patterns
Adapter
Bridge
Composite
Decorator
Façade
Flyweight
Proxy
Behavioral
Most of these design patterns are specifically concerned with communication between objects.
Patterns
Chain of Responsibility
Command
Interpreter
Iterator
Mediator
Memento
Observer
State
Strategy
Template Method
Visitor
Last updated