Implementing the Observer Pattern: Java Design Patterns and Architecture, Part 8

Now that we've got a taste of what the observer pattern is and how it works, we'll go the whole hog and implement it from scratch, creating a class that can fire events which listening objects can then receive. Although this may seem complex to beginners, it is a vital step in separating classes cleanly and avoid code tangles, at least in event driven programming -- i.e. situations whether something may arbitrarily happen in an object which other objects must then be notified about.



Source Code


DesignPatterns8 - Implementing Observer.zip

Next ...


An MVC Controversy: Java Design Patterns and Architecture, Part 9