Chapter 19. Observer Pattern

The observer pattern creates a one-to-many, unidirectional relationship between a source object and a set of observers. The observers receive a notification message whenever a property of the source object changes. The observers can use this information to stay in synchronization with the observed object or perform additional tasks.

Is it just me, or does that sound exactly like the provider/subscriber pattern from the last chapter? At this level of abstraction, the provider/subscriber and observer patterns are extremely similar. In Java, both would be implemented using listener interfaces, objects, and management as was illustrated in Chapter 18. But the observer and provider/subscriber patterns are different, as outlined ...

Get Learn Objective-C for Java Developers now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.