[Lying design pattern] Key notes: observer mode (Observer) (Publish / Subscribe)

[Lying design pattern] Key notes: observer mode (Observer) (Publish / Subscribe)


[CH.14]

Original defined:
the Define A One-to-SO MANY dependency BETWEEN Objects One Object that Changes When State, the DEPENDENTS are Notified and ITS All Updated Automatically.

The UML FIG:
p.193 herein by reference or

using the timing:
When a system the class is divided into a series of mutual cooperation has a bad side effect, and that is the need to maintain consistency between additional objects, but we do not want to maintain the consistency of the various types of tight coupling. Accordingly, when a change in the system need to change the object into a plurality of other object, suitable for use in this mode.

Mode features:
In the Subject class, all reference to the Observer object stored in a gathering in order to be able eleven notified when the change occurs.

The observer pattern with different intermediaries mode:
After I read the Observer and Mediator pattern mode, they feel some similarities, so they start looking for some data to try to clarify the differences and similarities between the two.
Mediator Observer and are used to transfer messages between objects, but Observer decentralized concept is achieved, and Mediator places to achieve a centralized manner. But, as seen GoF these words: "Mediator can leverage Observer for dynamically registering colleagues and communicating with them.". Saw this article, the feeling seems to be not so mutually exclusive in practice? !

Observer pattern of deficiencies:
In fact, no way to ensure that each class can practice the Update method of the Observer. Thus, with the commission in .NET technology to solve this problem.

Reference data:
http://www.dofactory.com/Patterns/PatternObserver.aspx
http://www.javaworld.com.tw/jute/post/view?bid=44&id=12526&sty=2&age=0&tpg=9&ppg=1# 12526
http://www.cnblogs.com/anders06/archive/2007/07/17/821483.html
http://www.dotspace.idv.tw/Jyemii/patternscolumn/articles/DesignPatternPart(3).htm
HTTP: //home.earthlink.net/~huston2/dp/observer.html

Original: Large column  [Lying design pattern] Key notes: observer mode (Observer) (Publish / Subscribe)


Guess you like

Origin www.cnblogs.com/chinatrump/p/11458545.html