what
In software engineering, a software design pattern is a general, reusable solution to
a commonly occurring problem within a given context in software design.
Design patterns are formalized best practices that the programmer can use to solve
common problems when designing an application or system.
GoF Design Patterns - Book
This book was first published in 1994 and it’s one of the most popular
books to learn design patterns. The book was authored by Erich
Gamma, Richard Helm, Ralph Johnson, and John Vlissides.
It got nicknamed as Gangs of Four design patterns because of four
authors. Furthermore, it got a shorter name as “GoF Design Patterns”.
3 Types
1.Creational patterns (Factory Method)
It deals with the creation of an object.
2.Structural patterns (Bridge,Adaptor)
It deals with the class structure
3.Behavioral patterns (Strategy,Observer)
It deals with interaction between objects.
=====================================================
1.Creational patterns (Factory Method)
a.Factory Method
Factory Method is a creational design pattern that provides an
interface for creating objects in a superclass, but allows subclasses to
alter the type of objects that will be created.
2.Structural patterns (Bridge,Adaptor)
a.Bridge
A Bridge Pattern says that just "decouple the functional abstraction
from the implementation so that the two can vary
independently".
b.Adapter
The adapter pattern convert the interface of a class into another interface.
By Using Adapter,incompatible interfaces can work together.
3.Behavioral patterns (Strategy,Observer)
a.Strategy
B. Observer
The Observer Pattern defines a one to many dependency
between objects so that one object changes state, all of its
dependents are notified and updated automatically