logo

 

     
 
Home
Site Map
Search
 
:: Bitwise Courses ::
 
Bitwise Dusty Archives
 
 
 

rss

 
 

ruby in steel

learn aikido in north devon

Learn Aikido in North Devon

 


Section :: books

- Format For Printing...

Design patterns : elements of reusable object-oriented software

Book Review
Saturday 13 September 2008.
 


Design patterns : elements of reusable object-oriented software
$59.99 / £41.99
by Erich Gamma, Richard Helm, Ralph Johnson and John Vlissides
Hardcover: 416 pages
Addison Wesley
http://www.awprofessional.com
http://www.compman.co.uk/
ISBN-10: 0201633612
ISBN-13: 978-0201633610

This is not a new book - it was first published in 1994 - but it is an important and an influential book, one that has stood the test of time (it is now on its 36th printing) and is regarded by many people as one of the rather small number of ‘classic’ computer texts.

If you are unfamiliar with this book, the first thing you may want to know is just what the heck a ‘design pattern’ is anyway? The simple answer is that it is some general ‘way of doing things’ - a recipe for creating a certain type of program or solving a specific type of problem. This book contains many such patterns, each of which is given a descriptive name such as the ‘Visitor’ pattern or the ‘Facade’ pattern. Each pattern is described in its own section, starting with a brief summary or ‘intent’, followed by a description of its aims or ‘motivation’ and then elaborated upon with a longer discussion of the problems of implementation and its consequences.

Here, for example, is the introduction (the ‘Intent’) to the Visitor pattern:

Represent an operation to be performed on the elements of an object structure. Visitor lets you define a new operation without changing the classes of the elements on which it operates.

The chapter itself goes on to describe the specific applications of this pattern (for example, in an AST - the ‘abstract syntax tree’ which is created when analysing source code for a compiler). It then illustrates the pattern with diagrams and code fragments before discussing its strengths (“Visitor makes adding new operations easy”) and weaknesses (“The pattern often forces you to provide public operations that access an element’s internal state, which may compromise its encapsulation”).

The source code examples, incidentally, are generally given in C++ which may not be everyone’s preferred OOP language (it certainly isn’t mine!), though the principles are also applicable to most other OOP languages and the authors frequently refer to Smalltalk and, occasionally, other languages.

I should say that this is not an ‘easy read’. It isn’t the sort of book you are likely to want to settle down with while taking a long, relaxing bath. Nor is it a ‘hands on’ book that guides you through each step of writing a program. Instead, it is a book that you may reach for when you are stumped by a certain sort of programming problem and you want to see how other programmers may have dealt with it before you.

‘Design Patterns’ discusses approaches to a number of specific problems such as spelling checking, hyphenation and avoiding ‘accumulated errors’ with multi-level undo/redo operations. It also has discussions about OOP ‘philosophy’ - encapsulation, separating applications into Model/View/Controller (MVC) parts, ‘white-box’ and ‘black-box’ reuse and so on.

In short, this is a book that both distils a wealth of knowledge and experience, challenges the reader to examine his or her ideas of good object oriented design and provides real-world examples of patterns put into practice. If you are a serious software developer, it definitely merits a place on your bookshelf.

AddThis Social Bookmark Button


Home