Construction Types:
Abstract factory, Factory, Builder, Prototype, Singleton (5)
Adapter Types:
Bridge, composite, deco, facade, flyweight, proxy (7)
Behavior Types:
Visitor, observer, interpreter, iterator, mediator (5)
Observer pattern:
- There are two kinds of object Subject and Observer. Whenever there is change on subject's state observer will receive notification. Common example of observer pattern is Social Network notifications - Facebook, Linkedin - notification mechanism. Subject is you and observers are your friends.
Execution Types:
command, chain of resp.(2)
Planning Types:
state, strategy, template (3)
- State design pattern is used to change Object's behavior based on it’s internal state.
- Context is the class that has a State reference to one of the concrete implementations of the State and forwards the request to the state object for processing.
Strategy pattern:
- Comes handy when you want to accomplish the same goal with different strategies. One good example of Strategy pattern is sorting a bunch of objects. JDK's Collections.sort() method and Comparator interface, which is a strategy interface and defines strategy for comparing objects. Because of this pattern, we don't need to modify sort() method (closed for modification) to compare any object, at same time we can implement Comparator interface to define new comparing strategy (open for extension).
Reward Types:
momento,
No comments:
Post a Comment