Grammar fixes for observer

This commit is contained in:
Ilkka Seppälä 2021-06-22 17:05:41 +03:00
parent 2b7cc410b0
commit bbc2a9ddb1
No known key found for this signature in database
GPG Key ID: 31B7C8F5CC412ECB
2 changed files with 5 additions and 9 deletions

View File

@ -21,10 +21,10 @@ dependents are notified and updated automatically.
## Explanation ## Explanation
Real world example Real-world example
> In a land far away lives the races of hobbits and orcs. Both of them are mostly outdoors so they > In a land far away live the races of hobbits and orcs. Both of them are mostly outdoors so they
> closely follow the changes in weather. One could say that they are constantly observing the > closely follow the weather changes. One could say that they are constantly observing the
> weather. > weather.
In plain words In plain words
@ -152,11 +152,7 @@ be changed.
* When an object should be able to notify other objects without making assumptions about who these * 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. objects are. In other words, you don't want these objects tightly coupled.
## Typical Use Case ## Known uses
* Changing in one object leads to a change in other objects.
## Real world examples
* [java.util.Observer](http://docs.oracle.com/javase/8/docs/api/java/util/Observer.html) * [java.util.Observer](http://docs.oracle.com/javase/8/docs/api/java/util/Observer.html)
* [java.util.EventListener](http://docs.oracle.com/javase/8/docs/api/java/util/EventListener.html) * [java.util.EventListener](http://docs.oracle.com/javase/8/docs/api/java/util/EventListener.html)

View File

@ -58,7 +58,7 @@ public class App {
weather.timePasses(); weather.timePasses();
weather.timePasses(); weather.timePasses();
// Generic observer inspired by Java Generics and Collection by Naftalin & Wadler // Generic observer inspired by Java Generics and Collections by Naftalin & Wadler
LOGGER.info("--Running generic version--"); LOGGER.info("--Running generic version--");
var genericWeather = new GWeather(); var genericWeather = new GWeather();
genericWeather.addObserver(new GOrcs()); genericWeather.addObserver(new GOrcs());