Home > Articles > Programming > Java

  • Print
  • + Share This
Like this article? We recommend


I once saw design patterns described as being from another world! They are amazing in the way that patterns provide power and economy in equal measures.

A programming world without design patterns would feature much drudgery and duplication. And yet, the sad fact is many developers don’t use patterns half enough if at all.

The observer pattern provides the kind of power we’ve come to expect from patterns. It allows for multiple observing clients to be updated as and when data changes occur. This asynchronous update approach avoids the need for expensive polling mechanisms in which the client continuously (and unnecessarily) asks for updates.

In this article, a simple GUI is used to drive data changes and the dissemination of that data to multiple observers. This approach is not only economical and flexible; it also provides for good separation of concerns. The latter is one of the key requirements of object-oriented development. By separating the concerns in this way, we reduce the risk associated with future code changes.

One final point to make about the observer pattern and the other design patterns is that they provide a vernacular to designers and programmers alike. Because the observer pattern is readily comprehensible, it could theoretically be used in architecture and in possibly even marketing documents.

Used in this way, patterns can form a bridge between the world of programming and the areas that feed into it. In this way, all participants can move up the value chain (see references [3] and [4]).

  • + Share This
  • 🔖 Save To Your Account