Tuesday 7 February 2012

Observer Design Pattern.

Observer Design Pattern used whenever a subject changes has to be observed by one or more observers.

Example domain usages: Stocks, Weather reports, News providers and Score providers, etc.

loosely coupling: Change of a state in one object must be reflected in another object without keeping the objects tight coupled.

Key problems
  1. Many Observers to Many Observables.
  2. We can have either push or pull method data transfers.
  3. When many Onververs and Observables comes we may need to introuduce new logic object responsible(ChangeManager) 
    1. Encapsulate the logic of notify the observers
    2. Maintain the many to many relations
    3. Receive the notifications from subjects and delegate them to the observers
Factory, Mediator and Template pattern can be used with in this design patterns.

No comments:

Post a Comment