Chapter 32. Observer: Evolving into a Pattern


© Jennifer M. Kohnke

I prefer to describe my profession as that of a "Contemporary Anthropological Interactive OBSERVER" because it has just the right amount of flair. Besides, "stalker" is such an ugly word.

Anonymous

This chapter serves a special purpose. In it, I describe the OBSERVER[1] pattern, but that is a minor objective. The primary objective of this chapter is to demonstrate how your design and code can evolve to use a pattern.

[1] [GOF95], p. 293

The preceding chapters made use of many patterns. Often, they were presented without showing how the code evolved to use the pattern. This might give you the idea that patterns are simply something you insert into your code and designs in completed form. This is not what I advise. Rather, I prefer to evolve the code I am working on in the direction of a pattern. I may get to the pattern, or I may not. It depends on whether the issues get resolved. It is not uncommon for me to start with a pattern in mind and wind up at a very different place.

This chapter sets up a simple problem and then shows how the design and code evolve to solve that problem. The goal of the evolution is the OBSERVER pattern. At each stage of the evolution, I describe the issues I'm trying to resolve and then show the steps that resolve them. With luck, we'll wind up with an OBSERVER.




Agile Principles, Patterns, and Practices in C#
Agile Principles, Patterns, and Practices in C#
ISBN: 0131857258
EAN: 2147483647
Year: 2006
Pages: 272

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net