Technology Electronic Reviews Volume 14, Number 1, June 2007

~ Return to more reviews in this issue

REVIEW OF Ken Pugh. (2006). Interface-Oriented Design. Raleigh, NC: The Pragmatic Programmer (ISBN: 0976694050). 215 pp. 29.95. 

By Martin R. Kalfatovic

The cover of Interface-Oriented Design depicts a traditional manual QWERTY keyboard, probably circa 1920 or so, with thin black Arial-fonted letters on creamy white discs. What does a typewriter keyboard have to do with interface-design? Why show us an antique piece of word-processing (since, after all, isn't that what a typewriter is?) hardware to discuss current programming practices? Pugh, with the wit and clarity that permeates the entire work, quickly dives in to explain that the typewriter keyboard is the perfect analogy for his topic. The QWERTY keyboard layout is an interface that has been around for the past 130 or so years. This interface has seen numerous implementations since being introduced, on manual typewriters, electric typewriters, and all forms of computers. By having been decoupled from any particular technology (rods and levers on the early typewriters to the latest technologies found on touch-screens and their ilk), the QWERTY interface has --  so far -- thrived.[1]

Divided into three sections (All About Interfaces; Developing with Interfaces; and Interfaces in the Real World), Pugh builds his topic from general interface design, through how to develop styles when thinking about interface design, and then concludes with a series of case studies.

Chapter 1 (Introduction to Interfaces) opens with the author's use of a pizza delivery system and how to build interfaces around the various functions users need. Pugh goes to great lengths to remind the user that an important element of interface oriented design is that you can achieve polymorphism of used (e.g. the same code can be read in form a keyboard or file and output to a display or a printer). Pugh's discussion of textual interfaces gives the reader a stroll down memory lane (the days when 64kb was a lot of memory!) with a discussion of the Hayes Modem textual interface (remember the ATDT[phone number], no? Ok, I'm old!). Maybe you remember writing a DOS .bat file build interfaces on your public terminals? -- never mind!)

Three law of of interface design (inspired by Isaac Asimov's Three Laws of Robotics, are described in Chapter 2 (Interface Contracts):

  1. An interface's implementation shall do what its methods says it does
  2. An interface implementation shall do no harm
  3. If an implementation is unable to perform its responsibilities, it shall notify its caller

Pugh digresses to discuss Betrand Meyer's concept of Design by Contract (covered in Meyer's 1997 book, Object Oriented Software Construction). The importance of how elements are used via the interface contract is explained. Chapter 3 (Interface Ingredients) includes a description of the elements of interface structure. The different conditions, sequential vs. random access to data; push vs. pull interfaces are all explained. How these four concepts relate is explained in a matrix that describes the three types of data interfaces:

  1. Simple API for XML (SAX)
  2. Document Object Model: (DOM)
  3. XML PullParser

In the next two chapters (Chapter 4: What Should be in an Interface? and Chapter 5: Inheritance and Interfaces), Pugh discusses how cohesion is an important element of interface design, but at the same time, cohesion is in the eye of the beholder. Likewise, Simplicity and complexity in interface design offer trade-offs and there is no single answer as to how this is best achieved. He also stresses the importance of considering inheritance of elements in design. Just as we want dollars to be inherited, it's important to consider how inheritance will affect other elements down the line. Using the analogy to Linnean taxonomic classification, Pugh points out that if elements inherit from parent elements, if there is a reclassification, this will cascade throughout the design in ways that the designer may not immediately understand. Chapter 6 (Remote Interfaces), covers how increasingly  systems work not in stand-alone environments but in interrelated webs. In this chapter, the author outlines various  considerations of using remote interface design. These include synchronous vs. asynchronous and statefull vs. stateless.

The second portion of the book (Developing with Interfaces) starts off with Chapter 7 (A Little Process). Noting that all developers use a process when programming, Pugh outlines a few of the styles commonly used and points out that most developers will fall somewhere on the spectrum between Rational Unified Process (RUP) and Extreme Programming (XP). As he does agile development in his work, Pugh give a brief synopsis of iterative development and how various tasks can be broken out. He also points out the importance of vision to software projects and the need to fully conceptualize the use of the system.. Retuning to the pizza ordering example, Pugh outlines various use case scenarios to show how the interface to the pizza delivery system should react and where various failure points can occur if any steps are left out.

The next chapters (Chapters 8-10) are specific examples of interface-oriented design. Chapter 8 (Link Checker) demonstrates how to use an interface to hide multiple implementations that parse a web page. Chapter 9 (The Web Conglomerator) shows how system work can be delegated to multiple implementations. Lastly, Chapter 10 (The Service Registry) presents a document-style interface and demonstrates some issues with documents. Progressively complex, the examples are clearly laid out and build on the concepts and skills that Pugh has outlined in the earlier portions of the book.

In the concluding chapter (Chapter 11: Patterns) describes the various ways for a system to implement an interface. The four (Factory Method; Proxy; Decorator; Adapter); Facade; and Composite). Each method is analyzed for pros and cons and Pugh gives a number of suggestions for using the appropriate pattern for the type of interface implementation that you are working on.

A useful appendix completes the book. In the appendix, Pugh gives additional resources and suggestion for follow-up on topics such as document style, service-oriented architecture, and collections and collecting methods.

Pugh directs this title to the developer with some experience programming and who has been exposed to object-oriented design. He claims that those with strong object-oriented skills will benefit and gain insight into their programming methodology by exposure to interface-oriented design. For Sudoku addicts, Pugh includes an example of an interface implementation for solving the pesky puzzles!

Pugh sprinkles a feature, "Joe asks..." throughout the book to provide quick answers to common questions that the typical reader may have about the subject at hand. These guides, as well as other guide or help text in gray boxes, are effective and provide the reader who wants more information with appropriate information. The book contains an index to key terms. A quick spot check of term in the text and the index showed a useful and effective index.

Ken Pugh is the author of five books on programming and operating systems, the most recent being Prefactoring (2005) which also won the 2006 Software Development Jolt Award. Cat lovers will also appreciate that he dedicates  Interface-Oriented Design to Nameless II, the cat who "sat on my lap while I typed this book." Recommended for programmers of all types who want to get a better handle on modular design and the use of interface-oriented design in particular.

Martin R. Kalfatovic is the Head, New Media Office and Preservation Services, Smithsonian Institution Libraries.

Copyright © 2007 by Martin R. Kalfatovic. This document may be reproduced in whole or in part for noncommercial, educational, or scientific purposes, provided that the preceding copyright statement and source are clearly acknowledged. All other rights are reserved. For permission to reproduce or adapt this document or any part of it for commercial distribution, address requests to the author.

1. Pugh provides us with a nice little aside on the development of QWERTY, debunking the myth that it was designed to slow down the typist to keep the keys from hitting each other or sticking togethe 

Technology Electronic Reviews (TER) is an irregular electronic serial publication of the Library and Information Technology Association, a division of the American Library Association, 50 E. Huron St., Chicago, IL 60611. The primary function of TER is to provide reviews of and pointers to a variety of print and electronic resources about information technology. Resources include books, articles, serials, discussion lists, training materials, bibliographies, and other items of interest to librarians and information technology professionals. The topics covered may include, but are not limited to, networking technologies and standards; hardware and software; operating systems; databases; specific programming languages; management tools and utilities; technical project management; training and personnel issues; library perspectives; and research and development.

Opinions expressed in this publication are those of the writers and do not necessarily represent the viewpoints of LITA, ALA, or organizations involved in the storage and/or distribution of the publication.

TER is distributed electronically via Internet. There is no subscription fee.

LITA provides its members, other ALA divisions and members, and the library and information science field as a whole with a forum for discussion, an environment for learning, and a program for action on the design, development, and implementation of automated and technological systems in the library and information science field.

LITA home page | TER home page