关闭

Observer pattern

75人阅读 评论(0) 收藏 举报
分类:

定义了对象之间的一对多依赖,这样一来,当一个对象改变状态时,它的所有依赖者都会收到通知并自动更新。
Define a one-to-many dependency between objects so that when one object changes state, all its dependents are notified and updated automatically.

Observer pattern is used when there is one-to-many relationship between objects such as if one object is modified, its depenedent objects are to be notified automatically. Observer pattern falls under behavioral pattern category.

The observer pattern is a software design pattern in which an object, called the subject, maintains a list of its dependents, called observers, and notifies them automatically of any state changes, usually by calling one of their methods. For more

Observer Pattern Tutorial with Java Examples
The Observer Pattern in Java

Java内置的观察者模式:
java.util.Observable
java.util.Observer

0
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:23467次
    • 积分:1450
    • 等级:
    • 排名:千里之外
    • 原创:130篇
    • 转载:6篇
    • 译文:0篇
    • 评论:0条