Monday, January 01, 2007

Book Review: Interface-Oriented Design

Interface-Oriented Design, Ken Pugh, The Pragmatic Programmers.  208 pages.

This is a nice, concise work on approaching system design from the interface-based viewpoint.  It’s nice because it’s language-independent and deals with most of the concepts from a psuedo-code viewpoint.  Most, but not all, of the actual implementation is in Java, but .NET folks ought not have any trouble making the leap to their platform.

This book didn’t quite grab me the way the interface-specific bits of Löwy’s .NET Components, 2nd ed.or similar parts of Robert and Micah Martin’s Agile Patterns and Practices in C# did, but it’s still a great book on its own.  There are a number of very valuable sections in Pugh’s work that don’t get covered in the Löwy’s or the Martins’ books.

Examples of very useful topics include good discussion on stateless versus stateful interfaces or why and how one might go about transforming interfaces from one shape to another.  (Adapter and Facade patterns are covered later in the book.)  There’s also an entire chapter to help you decide on what sorts of things should go in interfaces — and the printer examples in that chapter are particularly clear and useful.

I also liked Pugh’s use of his own Interface Responsibility Interaction cards, Pugh’s take on the extremely useful Class Responsibility Collaboration cards covered in various works by Ward Cunningham, Kent Beck, and Rebecca Wirfs-Brock.  IRI cards are a great way to help you create clear contracts for your designs.

Pugh’s coverage of  a URL link checker and Web conglomerator are practical examples showing how interfaces help in real world applications, not just some contrived, overly simplified bits.  Additionally, his closing chapter on patterns is extremely useful and hits several vital patterns: Factory, Adapter, Facade, and Composite.  His discussion of each includes, gasp!, pros and cons of each pattern — something we all ought to understand since blithe use of patterns can cause more problems then they solve.

Overall it’s a very solid book and a good addition to a programmer’s bookshelf.

(Plus he dedicated the book to “Nameless II, the cat who sat on my lap while I typed this book” so that scores bonus points with me.)

No comments:

Subscribe (RSS)

The Leadership Journey