Review of "Object-Oriented Software Construction"

Object-Oriented Software Construction, by Bertrand Meyer. ISBN 0-13-629155-4.

Part beginner’s guide, part encyclopaedia, part manifesto: this is an exhaustive, closely argued, presentation of Bertrand Meyer’s opinions about how software should be made, which collectively he calls "the object-oriented method". For the most part, I like his opinions.

OOSC seems to have trouble making up its mind whether it is a book about good methods for developing software or a book about good programming languages. Meyer pretends that it is almost entirely the former, referring to the language he’s advocating simply as "the notation" throughout the book, but in fact the latter is never far from view. One consequence of this is that the book’s description of how to develop software is to a considerable extent structured in terms of language features and implementation details. When the book is seen as a presentation of a programming language, this makes a great deal of sense. When it’s seen as a book about how to develop software, I’m not sure it does.

However, this attention to detail is one of the book’s merits. While many of Meyer’s opinions are debatable, he almost always offers considerably more defence for them than is usual in books at this level, and he usually does a decent job of describing opposing views.

I should say a bit about what those debatable opinions are. Meyer is a strong advocate of verifiable software, by which I mean software that embodies automatically checkable statements about what it is supposed to do. Therefore, he favours static over dynamic typing, emphasizes assertions (and enshrines them in his language and his method, under the general heading of "design by contract"), and greatly restricts how exceptions may be used. He wants inheritance to be the primary mechanism of reuse, and accordingly permits multiple inheritance and allows inheriting classes to remove, rename and redefine features from their parents with what some would consider excessive leniency. He sees genericity and automatic memory management ("garbage collection") as essential to object-oriented programming. And he has a million and one other strong opinions; he seldom mentions any idea without endorsing or condemning it.

The book is in eight parts:

It is punctuated by frequent principles, rules, definitions and other such brief dicta, maybe 200 in all, set forth prominently and indexed in an appendix.

Most readers will divide the book’s contents into three portions: those that are familiar and unsurprising, those that are unusual and insightful, and those that are unusual and insane. I suspect there will be less than complete agreement on where the line between the second and third portions goes.

For me, Meyer’s famous exposition of "design by contract" and its relation to inheritance is the best material in the book. The idea of contracts is slowly seeping into the culture of software development, but it deserves a much more prominent place than it usually gets.

The worst material in the book? Well, Meyer’s equally famous, um, confidence in his opinions is often grating, especially when it disagrees with my own (much more humbly held, ahem) opinions. His justification of covariant parameter types is particularly ludicrous. In general, it would have been nice to see a fuller discussion of the features of his language that conflict violently with the principles of "design by contract": notably feature renaming and removal and covariant parameter types.

The material that annoyed me most was in fact his discussion of some of my own eccentric preferences: dynamic typing and the object-oriented features of Common Lisp. Suffice it to say that much of what Meyer says on these subjects is demonstrably inadequate.

Meyer writes well, and explains things with admirable clarity and precision. (His approach is very mathematical; it is possible that not everyone will find it as clear as I do.)

The book is accompanied by a CD-ROM which contains its entire text (in PDF, with hyperlinks) as well as a time-limited version of Meyer’s company’s development environment.

Binding a book of 1200 pages isn’t easy to do well. I haven’t cracked the spine yet. However, the covers have an apparently uncontrollable tendency to curl outwards. The typography of the book is decent rather than good. I liked the use of blue for "formal" parts of the text (that is: material written in a formal notation such as a programming language), despite the occasional misregistrations. Others may disagree.

OOSC purports to be (among other things) an introductory work. I would hesitate to recommend it to anyone who isn’t a fairly expert programmer already; not because of its difficulty, but because an expert is more likely to appreciate Meyer’s genuinely good ideas and less likely to be taken in by his mistakes and prejudices. For such readers, however, I strongly recommend it.