Gang of Four Design Patterns by Example
In software engineering, Design Patterns are best practices/way to solve particular type of problems. They should occur naturally in your code but if they are enforced, you will end up writing bloated/messy code, that’s why you should be aware of patterns but before applying them, you should properly analyze the problem. Along with that you should also consider if language or tool you are using have already some better approach to solve the problem in standard library.
According to approach or architecture you are using you may find different patterns like Design Patterns for Cloud, Micro-services, UX, OOP or IoT. Here I’ll be discussing about 23 Gang of Four Design Patterns, which applies to Object Oriented Programming. They were originated from a book called Design Patterns: Elements of Reusable Object-Oriented Software, which was published in 1994 by 4 awesome people(Erich Gamma, Richard Helm, Ralph Jahnson, Josn Vlissides) who are better known as Gang of Four.
Here is what wikipedia says about this
Design Patterns: Elements of Reusable Object-Oriented Software is a software engineering book describing software design patterns. The book’s authors are Erich Gamma, Richard Helm, Ralph Johnson and John Vlissides with a foreword by Grady Booch. The book is divided into two parts, with the first two chapters exploring the capabilities and pitfalls of object-oriented programming, and the remaining chapters describing 23 classic software design patterns. The book includes examples in C++ and Smalltalk.
GoF Design Patterns are classified in 3 types, Creational, Structural and Behavioral.
This work is in Progress, State is mentioned whether completed/work in progress/yet to start. Feel free to explore completed ones.
Behavioral Design Patterns
- Chain Of Responsibility Pattern -yet to start
- Command Pattern -yet to start
- Iterator Pattern -yet to start
- Mediator Pattern -yet to start
- Memento Pattern -yet to start
- Observer Pattern -yet to start
- Visitor Pattern -yet to start
- Strategy Pattern - Completed
- State Pattern - Completed
- Template Method Pattern - Completed
Creational Design Patterns
- Simple Factory Pattern -yet to start
- Factory Method Pattern -yet to start
- Abstract Factory Pattern -yet to start
- Builder Pattern -yet to start
- Prototype Pattern -yet to start
- Singleton Pattern -yet to start
Structural Design Patterns
- Adapter Pattern -yet to start
- Bridge Pattern -yet to start
- Composite Pattern -yet to start
- Decorator Pattern -yet to start
- Facade Pattern -yet to start
- Flyweight Pattern -yet to start
- Proxy Pattern -yet to start