课程: Python: Design Patterns (2021)
今天就学习课程吧!
今天就开通帐号,24,700 门业界名师课程任您挑!
Observer
- [Narrator] The observer pattern establishes a one too many relationship between a subject and multiple observers. Our problem here is that a subject needs to be monitored and other observer objects should be notified when there is a change in the subject. In our scenario, we keep track of the core temperatures of reactors at a power plant. When there is a change in the core temperature, registered observers must be notified. Our solution uses an abstract class called subject, which has the interface that allows operations such as attaching, detaching, and notifying observers. We also need concrete subject classes inheriting from the abstract subject class. Singleton is related to the observer design pattern.
内容
-
-
-
-
-
-
(已锁定)
Observer1 分钟 5 秒
-
(已锁定)
Observer example6 分钟 22 秒
-
(已锁定)
Visitor56 秒
-
(已锁定)
Visitor example6 分钟 42 秒
-
(已锁定)
Iterator1 分钟 15 秒
-
(已锁定)
Iterator example4 分钟 32 秒
-
(已锁定)
Strategy40 秒
-
(已锁定)
Strategy example5 分钟 44 秒
-
(已锁定)
Chain of responsibility1 分钟 4 秒
-
(已锁定)
Chain of responsibility example5 分钟 57 秒
-
(已锁定)
-
-