Nicholas Sharples
As Object Orientated languages become ever more popular in mainstream software development. Experienced developers are finding difficulties in designing large class structures which are flexible and easy to maintain. Anyone that's attempted to construct even a simple application with few classes and little inheritance, will understand the difficulties you can encounter and it's so easy to get overburdened with the choices of implementation available. Even traditional programmers with years of experience in languages like C and Pascal, struggle when it comes to designing class structures and find it difficult to picture the various interactions between objects. If you think your one of the them, or you've been programming with objects for years, I strongly recommend 'Design Patterns Elements of Reusable Object-Oriented Software'. It's not a book for those unfamiliar with object-orientated programming, but for those who know how to program but want to do it better. As the title suggest the books aim is to provide the developer with a catalogue of generic methods called patterns which solve common problems faced when designing software. A pattern is defined within the book as ``descriptions of communicating objects and classes that are customized to solve a general design in a particular context''. I know it's a bit of a mouthful at first, but it does succinctly convey the purpose of design patterns.
When I first started reading this book I had years of experience with traditional languages and had been using object-orientation for just over 12 months. I felt reasonable confident with it, having successively implemented several reasonable sized applications. The programs I produced worked and the documentation provided gave guidance to anyone who wanted to carry the development further. The problems came during the maintenance phase, any changes made, however small, required a full knowledge of the classes used within the system and how they interacted. The more the code altered from the original the more ``hacky'' it seemed to get. I wanted to produce easy to use frameworks, generic and flexible which could easily be extended. If you recognised this scenario then this is the book for you or if your designing a complex system and want to do it right first time, keep this book close at hand.
Chapter 1 starts with the line :
Designing object-oriented software is hard and designing reusable object-oriented software is even harder.
When I first read that I thought ``Exactly! Now how do I do it'', and I wasn't disappointed. It continues by introducing patterns as tried and trusted methods that can be applied to solve specific problems, and explains the philosophy behind them. Why composition is better than inheritance, and how their design helps you plan ahead for change. I found this a little hard going at first, although I was looking forward to the fruits of my labour, and the introduction warns you that you may not understand it the first time through. The second chapter is a case study in designing a WYSIWYG text editor using patterns, presenting the problems you'd encounter and how a pattern could be applied to solve it. For me this was pure inspiration and compulsive reading, or as close as a book about programming could get to it. It clarified the first chapter, as each problem was encountered you could stop reading, think about the problem and try and solve it, your own way. The design pattern was then applied which allowed you to see the advantages the pattern gave.
Subsequent chapters describe the patterns them selfs dividing them into three main categories. Creational which deals with the creation of objects, structural which deals with the composition of classes or objects and behavioral which deals with the interactions between classes or objects. Each pattern is broken into various sections like applicability, the context in which the pattern should be used, and structure giving a graphical representation of the classes used in the pattern. Most come with source code and interaction diagrams, which really explain the methodology used. Although the source code is written in C++ it's easy to follow and could easily be converted in any object-orientated language of your choice.
You must be wondering if I have anything bad to say about this book, well, not really, in fact no I don't. It's not for the light hearted, but we're all sick of reading the same old dirge about object-orientated programming. Here's a classes, here's inheritance, oh and a quick talk on polymorphism, then it's off you go and write an object-orientated program. Well the world doesn't work like that, it's fine if your a beginner and unfamiliar with classes and the syntax of the language, but not when your trying to work out the best way to iterate over a linked list of differing element types. You can read books that tell you what a good design should look like, Booch for instance, but it's very long winded and not really bed time reading. This is one of the few books which really deals with the issues faced during everyday development of object-orientated applications.
In conclusion, this is the best book since Code Complete, and if you don't know what that is, read it. If your programming in the object-orientated paradigm, you really won't regret buy this book.
