REVIEW - Design Patterns and Contracts

Title:

Design Patterns and Contracts

Author:

Jean-Marc Jézéquel, Michel Train, Christine Mingins

ISBN:

0201309599

Publisher:

Addison-Wesley Longman (2000)

Pages:

348pp

Reviewer:

Roger N Lever

Reviewed:

August 2000

Rating:

2 out of 5

Design patterns are becoming a de facto standard, slowly, in software development. Therefore, books that include this term in their title are eye-catching, especially if combined with contracts. Contracts are an important subject in their own right and so combining that with design patterns would seem to be a sure fired way to success.

On the positive side, the book covers the GoF design patterns with code implementation examples. The explanations are short and succinct and provide a worked code example with some useful clarification. There is an overview of design patterns in a software engineering context and with contracts. Finally there are sections covering patterns and user interfaces and software configuration management.

However, there are some notable disappointments:

  1. Too many areas are included with insufficient depth, the less charitable would call it 'padding'
  2. The code is in Eiffel, so the examples are immediately less accessible than C++ or Java
  3. The example code uses a dungeons and dragons game theme - maze, rooms, doors... not terribly useful
  4. All the code appears to be printed in the book, again the less charitable would call it padding
  5. The treatment of contracts is somewhat superficial, the subject could have been significantly expanded
Overall I was disappointed with the book because I was expecting more from it. I was expecting to see design patterns, in the context of C++ or Java and the effect of applying contracts to them. At a simplistic level that would simply be code with pre and post conditions to parameters. However, I would have wanted to see a discussion going into some depth on:
  1. Passing parameters in various ways and the impact of those choices on design
  2. Relationship of contracts and defensive programming
  3. Relationship of contracts with inheritance, polymorphism and encapsulation
  4. Effect of applying contracts on performance
  5. Rules of thumb regarding when contracts are useful
  6. Rules of thumb regarding avoiding duplication of applying pre/post conditions to code
If the above book had been written it would have been much more useful. As it is the book has significantly less value.

Book cover image courtesy of Open Library.