Software Quality

January 30, 2010

Book Review of Design by Contract, by Example, by Richard Mitchell and Jim McKim

Filed under: Code Contracts, Practices — Tags: , — David Allen @ 3:00 pm
In February, I will be giving a presentation to the Minnesota Visual Studio user group. I wanted to recommend some books that would help those who are new to contract programming practices. The only book I could think of was the legendary Object-Oriented Software Construction second edition by Bertrand Meyer.  I love that book. It was my first introduction to object-oriented programming and Design by Contract. It goes into tremendous depth on a variety of programming principles that go well beyond contracts alone. Unfortunately, the book is enormous (over 1200 pages), and can be quite intimidating to some people. I believe this size and complexity make it a poor choice for the busy professional programmer who wants to learn about contract programming practices with limited training time. So I searched the Internet, and found a book, Design by Contract, by Example, by Richard Mitchell and Jim McKim.  I recommend it for anyone who wants to learn more about the principles and practices of programming with contracts. I like the fact that the book is well organized, and easily digestible (less than 250 pages). 
For those who are new to programming with contracts, I think the principles and guidelines offered are important ones, and worth your scarce training time. With the introduction of the Microsoft Code Contracts as a mainstream component of the.net 4.0 framework, I expect this book to help fill a strong appetite from experienced programmers who are new to the notion of programming with contracts. For those of you who are experienced users of design by contract, this will be an easy read, yet a study of this material may enrich your understanding of the practices you already know.
I use contracts on a regular basis in my commercial programming. I have started using the six principles and five guidelines explained in the book as a checklist to evaluate my current product code. In doing so, I am looking at my code through a fresh set of eyes, finding weaknesses, and improving the clarity and reliability of the code. 

 There are some book reviews on Amazon.com.  Here are my response to some of the criticisms mentioned there: 

“Not enough material, March 9, 2006” –

While I sympathize with many of the complaints of this reviewer, I still believe this book is a great introductory text for people who are learning to program contracts. Perhaps it would have been helpful to have examples of code contracts in more diverse domains rather than yet another example of the stack and the queue. This sounds like an opportunity to either expand the book in a second edition. Or another author may take advantage of this opportunity. 

“I think contracts are not very strong tool, May 23, 2005” 

As a commercial programmer who uses contracts and real product code, I can testify that the ideas in this book ARE practical in commercial applications. I have never found contracts to be too complex or hard to maintain. Admittedly there are problems in computer science with contracts do not solve. Contracts are not a magical silver bullet. Yet they remain very powerful and useful. 

 If you have read this book and have an opinion of your own, I would welcome your comments here or on the Amazon book review site.

Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Blog at WordPress.com.

%d bloggers like this: