Skip to content

Commit 312cbe2

Browse files
committed
Update README.md
1 parent c61198b commit 312cbe2

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,13 @@
188188
##Observer
189189
**Intent:** Define a one-to-many dependency between objects so that when one object changes state, all its dependents are notified and updated automatically.
190190

191+
![alt text](https://github.com/iluwatar/java-design-patterns/blob/master/observer/etc/observer.jpg "Observer")
192+
193+
**Applicability:** Use the Observer pattern in any of the following situations
194+
* when an abstraction has two aspects, one dependent on the other. Encapsulating these aspects in separate objects lets you vary and reuse them independently
195+
* when a change to one object requires changing others, and you don't know how many objects need to be changed
196+
* when an object should be able to notify other objects without making assumptions about who these objects are. In other words, you don't want these objects tightly coupled
197+
191198
##State
192199
**Intent:** Allow an object to alter its behavior when its internal state changes. The object will appear to change its class.
193200

0 commit comments

Comments
 (0)