TechBookReport logo

Keywords: Design patterns, object oriented design, Java

Title: Design Patterns Explained

Author: Alan Shalloway and James R. Trott

Publisher: Addison Wesley

ISBN: 0321247140

Media: Book

Level: Introductory design patterns

Verdict: Highly recommended first book on patterns

To the uninitiated design patterns can appear to be some sort of mysterious secret language that is inaccessible to mere mortals. While the basic idea of reusing good design to solve frequently occurring problems is simple enough to grasp, the actual details seem to be couched in a form that makes them hard to contextualise and harder still to use in practice. If this is your experience then help may be at hand in the form of this useful little volume.

The aim of this book are simple - to make design patterns accessible and useful to the average developer. To this end the authors make a point of explaining both the history and background of the design patterns movement and also looking at the problems this movement set out to address in the world of object oriented development. This context is important because without it understanding of design patterns can be severely restricted. Knowing when and how to apply the patterns is more than half the battle.

Following this background material, along with a chapter that introduces UML, the book presents a real-world problem to tackle. The problem, how to extract information from a CAD/CAM system, is used both to illustrate the limitations of traditional object oriented design and to show how design patterns provide simpler and more elegant solutions. The problem is well-chosen in that it is obviously real, is not something obscure or overly specialised and yet it serves to highlight a problem that recurs in all types of object oriented development.

The problems high-lighted are to do with the limitations of inheritance, the problems of tight-coupling of designs and the implicit danger of designs that become ever more complex as requirements change. These are major issues and this book, like David West's 'Object Thinking', suggests that objects should be based on behaviour as much as on encapsulating. This means programming to interfaces, using polymorphism to maximum effect and leading to highly cohesive yet loosely coupled code. Again this is echoed in 'Object Thinking' and 'Better, Faster, Lighter Java' two name but two recent books.

Having explained the problems in clear, concrete terms, the authors move on to looking at design patterns in more detail. Part three of the book looks at five design patterns in all: Fašade, Adapter, Strategy, Bridge and Abstract Factory. In each case the pattern is discussed in relation to real problems and to more general requirements. In addition Java code is used to translate the pattern into a concrete solution that makes things even clearer (the web site associated with the book includes sample code in C#). Note that you don't have to be a Java progrrammer to gain from this book, though if you can code in Java then so much the better.

Aside from design patterns, the book also takes a broader look at software development methodologies, particularly emphasising that agile technologies. There is, the authors contend, no contradiction between the solid design principles that patterns have to offer and the code-oriented techniques of agile technologies such as extreme programming (XP).

The book does more than offer a pre-defined list of patterns, however. The key to using patterns is an analysis tool that allows the developer to recognise where and when different patterns are applicable. To this end the book includes a set of principles and an analysis process that focuses on drawing out the features of a problem such that it becomes easier to come up with elegant designs that make the best use of design patterns.

In the process of exploring this analysis method more patterns are discussed, including Decorator, Observer, Singleton, Object Pool and more.

Mention must be made of the simple, but not simplistic, writing style of the book. The writing works, it's direct, clear and provides the reader with a lot of benefit, in contrast to some of the more esoteric writing on design patterns. This is an ideal book on design patterns for the beginner and is highly recommended.

Hit the 'back' key in your browser to return to subject index page

Return to home page

Contents © TechBookReport 2004. Published December 13 2004