Design Patterns

Design patterns:
Design patterns represent the best practices used by experienced object-oriented software developers. Design patterns are solutions to general problems that software developers faced during software development.

Gang of Four (GOF)
Design patterns gained popularity in computer science after the book Design Patterns: Elements of Reusable Object-Oriented Software was published in 1994 by the so-called “Gang of Four” (Gamma et al.), which is frequently abbreviated as “GoF”.

As per them..

  • Program to an interface not an implementation
  • Favor object composition over inheritance

Types of Design Patterns

  1. Creational Patterns:
    These design patterns provide a way to create objects while hiding the creation logic, rather than instantiating objects directly using new opreator. This gives program more flexibility in deciding which objects need to be created for a given use case.
  2. Structural Patterns:
    These design patterns concern class and object composition. Concept of inheritance is used to compose interfaces and define ways to compose objects to obtain new functionalities.
  3. Behavioral Patterns:
    These design patterns are specifically concerned with communication between objects.

Creational Patterns
Singleton
Factory method
Abstract factory
Builder
Prototype
Object Pool
Lazy initialization
Multiton
Prototype

Structural patterns
Adapter
Facade
Bridge
Composite
Decorator
FlyWeight
Proxy
Marker
Module
Twin

Behavioral patterns
Strategy
State
Observer or Publish/Subscribe
Chain of responsibility
Command
Interpreter
Iterator
Mediator
Null Object
TemplateMethod
Visitor
Blackboard
Memento
Servant
Specification

Details to be continued…