GoF Design Patterns Overview

Connect with

There are three different category of Design pattern i.e.

  1. Creational Design Pattern : used for creating object in software design pattern.
  2. Structural Design Pattern : refer for structuring of object(s) in software design pattern.
  3. Behavioral Design Pattern : used for behavior of objects in software design pattern.

1. Creational Design Pattern

  1. Deal with one of the most commonly performed tasks in an OO application, the creation of objects.
  2. Support a uniform, simple, and controlled mechanism to create objects.
  3. Allow the encapsulation of the details about what classes are instantiated and how these instances are created.
  4. Encourage the use of interfaces, which reduces coupling.
[table “” not found /]

2. Structural Design Pattern

[table “” not found /]

3. Behavioral Design Pattern

[table “” not found /]

4. Collectional Patterns

Collectional pattern primarily deal with group or collections of Object. It allow the definition of operations on collections of objects, which are follows:

  • Composite:
  • Iterator:
  • Flyweight:
  • Visitor:

One liner

[table “” not found /]

Strategy Vs Template Method
Template Method job is to define the outline of an algorithm, but subclass do some of the work. It means , I ( Template) have more control over my algorithm and I don’t duplicate code. All the duplicate code put into super class so that all subclass share those code.
Strategy method use object composition while Template use inheritance. Click here Template Method Vs Strategy Design pattern

Who wraps object for what?

Adapter: Wraps another object and provides a different interface to it.
Decorator: wraps another object and provides additional behavior for it.
Facade: wraps a bunch of objects to simplify their interface.
Proxy: wraps another object to control access to it.

References


Connect with

Leave a Reply

Your email address will not be published. Required fields are marked *