Sunday, 7 December 2014

what are the Design Patterns present and why it is needed ?

              Design patterns are used to give a solution for the software problems. It is used to create a common place for reuse a code. Generally design patterns are not only follow for create a reusable code and also importantly for encapsulate the objects from the client.

There are three types of design patterns.
  1. Creational Pattern 
  2. Structural Pattern
  3. Behavioral Pattern
Creational Pattern
  • Singleton             -   A class have only one instance for whole application to the client
  • Builder                -   A class can build an object by running a many grouping sets
  • Prototype            -   A class must have a copy or cloned of a same object through interface
  • Factory method  -   Creates objects with out exposing the instantiate logic to the client and                                              refers the object through the common interface.
  • Abstract Factory -  Creates a family of related objects with out specifying there classes 

Structural Pattern
  • Adapter            -     Convert the interface of a class in to another interface according to the                                                  client need
  • Composite        -     Compose objects in to tree structure to represent part or full hierarchy
  • Proxy               -      An object represent an another object
  • Facade             -     A single class describes about the entire object and there subclass
  • Flyweight         -    This pattern is used to give a efficient sharing.
  • Decorator        -     Add additional functionality dynamically to an object.
  • Bridge              -     it is almost like composite. separates the implementation of objects.
Behavioral Pattern
  • Observer            -   It contains about the objects which needs the notification when there is                                                 change
  • Chain Of Resp   -   Passing a request between the chain of objects, it avoids the attaching the                                     sender information to the receiver so, other objects can handle the request.
  • Iterator              -   Iterating the sequence of element collection.
  • Strategy             -   Defines a family of algorithms, encapsulate the algorithm inside a class
  • Command          -   Encapsulate a request in an object, allow the parameters of clients with                                            different request.
  • Interpreter         -  Give a grammar with interpret to represent the interpret logic in the                                                         language
  • Mediator            -   It gives the loose coupling by object referencing explicitly
  • Visitor                -   It Let you to define a new functionality with changing the class of the                                                  elements
  • Template Method - applying the same steps of algorithm to the subclass
  • Memento            -  Capture the internal state of an object with out violating encapsulation.
  • State                   -  Alter the behavior of an object when state changes

From this article you can learn what are the design patterns present and why it is needed.

No comments:

Post a Comment