Gang Of Four Design Patterns

Q- What are the Gang of Four Design Patterns?

Creational Design Patterns

Structural Design Patterns
Behavioral Design Patterns

Q- What is the differenc between facade and strategy design pattern?

Facade : Facade is structural design patterns. So we can say using facade we can design structer using interface and its implementation.
Strategy :  Strategy is behavior design patterns. So we can say using strategy we can design how the objects are communicate to each other.

Q- What is difference between Facade Design and bridge design pattern?

A bridge design pattern is created to seperate the implementation from the API. A bridge tends to be created to support pluggability of the implementation into different APIs.
A facade design pattern is used to create single interface by using set of design pattern. A facade is an API created on top of a set of APIs or methods. It provides the ability to interface with a single API where there are actually several.

Q- What is the difference between Adapter and Bridge Design Pattern?

Q- What is the difference between Strategy Design Pattern and Bridge Design Pattern?

Strategy Design Pattern is used for Behavioural decisions, while Bridge Design Pattern is used for Structural decisions. Brigde Pattern separats the abstract elements from the implementation details (to seperate the implementation from the API), while Strategy Pattern is concerned making algorithms more interchangeable.

Bridge: ( A structural pattern)
Bridge pattern decouples abstraction and implementation and allows both to vary independently.
Use this pattern when :

  • Abstractions and implementations on an API  not been decided at compile time
  • Abstractions and implementations of and API should be changed independently
  • Changes in implementation of abstraction should not affect in our application
  • Client should be insulated from implementation details.

Strategy: ( Behavioural pattern)
Strategy patterns enable you to switch between multiple algorithms from a family of algorithms at run time.
Use Strategy pattern when :

  • While multiple versions or multiple way of an algorithms are required
  • While we have to choose the behaviour of class changed dynamically at run time
  • To avoid conditional statements in an algorithms. 

No comments:

Post a Comment