3 Apr 2016

Design Patterns (Brief)

9Design Patterns

CREATIONAL ( Object Creation)
1. Factory Method
      creating an instance of several of derived classes.
2. Abstract Factory
     creating a family of classes.
3. Builder
     Builds the object in parts. (step by step)
4. Singleton
     Only one instance of an object to be created.
5. Prototype
       Fully initialized object need to be copied or cloned.

   1. Adapter
           Eg: different classes having different interface, we need adapter to match the interface of classes
2. Bridge
       When product is sold , support team separating the developing team from customer.
3. Composite
     is mainly involved in tree of Simple and composite (complex) objects.
4. Decorator
       used to add responsibility to the object at runtime dynamically.
5. Proxy
      used when you want an object to represent another object.
6. FlyWeight
     used when a fine grained object to be used efficiently.
7. Facade
   single class is representing sub-system. Abstract the complex structure.
     1. Chain of Responsibility
              while passing request to chain of objects.
    2.  Command
              encapsulate the request in object
   3. Interpreter
           includes the language element in the program
  4. Iterator
         used when to take out traversal item in the list.
5. Mediator
     When we want to simplify between two objects.
6. Memento
        when we want to capture and restore (Eg: Undo operation)
7. Visitor
       defines new operation to class without changing the class.
8. Template
     differ exact steps to sub class.
9. Strategy
    to encapsulate an algorithm in a class.
10. State
         to alter object behavior only when its state change.
11. Observer
            to notify the change to other objects, (publish and subscriber).


Post a Comment