måndag 8 november 2004

Review: Design Patterns

For the past three years or so, I’ve been hearing increasingly more about software patterns. Some regard them as the best thing since sliced bread. If you dig through the hype, you will find a clever way of describing common software constructs in a de-facto standard vocabulary with which an increasing number of software developers are familiar.
If you have any experience with software development, you probably at some point devised a mechanism by which interested object instances could register to receive events emitted by other objects. If you’re anything like me, you probably did not know at the time that you were actually implementing a variant of the Observer pattern. Similary, you may have created a class returning new instances of appropriate subclasses of abstract objects without knowing you were using the Abstract Factory pattern. And you may not have known that the iterators of the C++ Standard Template Library were designed around a pattern later to be known as the Iterator pattern.
As with most new software development methodologies, patterns were — in my view — excessively hyped for a period. Now that things have calmed down, it is possible to evaluate patterns on their own merits — and those merits do not necessarily constitute providing revolutionary new design principles. Rather, they provide a way to express common programming constructs in a language-independant way, which must be a Good ThingTM.
If you have somehow missed the patterns hysteria and would like to get into it, I really recommend the excellent book by Gamma (as well as Helm, Johnson, and Vlissides), one of the authors who pioneered the concept (and who later created the very useful JUnit unit testing framework).
The book provides a useful summary of all established patterns on the first few pages, and then goes on in subsequent chapters to explore each pattern in great detail, providing examples and plenty of motivation for the design decisions made. This book is the reference to software patterns and you should probably consider getting one for your bookshelf.
If you prefer a more concise summary, there are some excellent pages available on-line that provide just that — in Microsoft’s excellent C# language, no less.



Inga kommentarer:

Skicka en kommentar