Friday, February 25, 2005

Too Much Information

This article appears in slightly different form in the January/February 2005 issue of IEEE Micro © 2005 IEEE.

Sometimes the stack of interesting books gets too tall. I can only review a few each time, but there are many more that are too good simply to pass over. This time I look briefly at a number of books I wish I could spend more time with.

Patterns and Code

The idea of a pattern language arose in the context of architecture. In their 1977 book, A Pattern Language: Towns, Buildings, Construction, Christopher Alexander and others try to abstract and name the architectural approaches that lead to satisfying spaces. 

Computer scientists took up Alexander's ideas. In October 1994, Addison-Wesley published Design Patterns -- Elements of Reusable Object-Oriented Software by Erich Gamma, Richard Helm, Ralph Johnson, and John Vlissides (these authors are now commonly referred to as the gang of four). This book gave programmers a new vocabulary and a new way to look at the structure of their programs. 

Over the ten years since Design Patterns appeared, the book's influence has grown. Design patterns have become a part of the computer science curriculum. Yet many programmers are unsure of how to apply well known design patterns in practical situations. The gang of four did not write an easy book, and more accessible books are just beginning to appear.


Head First Design Patterns by Eric Freeman & Elisabeth Freeman (O'Reilly, Sebastopol CA, 2004, 676pp, ISBN 0-596-00712-4, www.oreilly.com, $44.95)

Eric Freeman and Elisabeth Freeman are computer scientists who led digital media and Internet efforts at the Walt Disney Company. They have produced a series of Head First books (www.wickedlysmart.com) in what they describe as "a visually rich format designed for the way your brain works." Not everyone's brain works the same way, of course. I usually find "visually rich" formats confusing and distracting, but I like this one. They have not used pictures as a substitute for words. Rather, they present material in a variety of ways. They encourage you to read the book with a pencil in hand and to write your own solutions to problems before you read their solutions. They work their way through problems -- with plenty of alternatives and instructive false starts -- until you really understand the pattern they are discussing.

The authors are aware that books about programming can be boring. They have succeeded in making this one fun. They assume that you are reading their book because you want to know:
  • The patterns that matter.
  • When to use them, and why.
  • When not to use them.
  • The object-oriented design principles underlying them.
If you read their book, I think you will achieve those objectives.


Refactoring to Patterns by Joshua Kerievsky (Addison-Wesley, Boston MA, 2004, 394pp, ISBN 0-321-21335-1, www.awprofessional.com, $49.99)

Joshua Kerievsky runs a company that specializes in extreme programming (XP). One of the core competencies of an XP practitioner is refactoring (see Micro Review Nov/Dec 1999). Martin Fowler's book Refactoring -- Improving the Design of Existing Code (Addison-Wesley, 1999) puts names on common forms of refactoring and shows how to perform them. 

The original gang of four book claims that design patterns are targets for refactoring, but Fowler does not make this connection explicit. Kierevsky does so. He also introduces the concept of a before-and-after study of a refactoring.

In studying refactorings, Kerievsky comes back to the principles underlying the design patterns and object oriented design. He writes clearly and patiently. He is an excellent teacher. He moves easily between principles and details

Books often have forewords by well known names in the field. This book carries that sales pattern to a new level. It contains forewords by Ralph Johnson and Martin Fowler and an afterward by John Brant and Don Roberts. It also has blurbs of advance praise from Kent Beck, Erich Gamma, Ward Cunningham, Sven Gorts, Bruce Eckel, Craig Larman, and others. All those people have read this book, and you haven't? What are you waiting for?


Fearless Change -- Patterns for Introducing New Ideas by Mary Lynn Manns & Linda Rising (Addison-Wesley, Boston MA, 2004, 296pp, ISBN 0-201-74157-1, www.awprofessional.com, $24.99)

This book addresses a problem that most people can understand and identify with, namely, how to put forth your ideas in a way that maximizes their chance of adoption. Mary Lynn Manns is a manaagement professor who has specialized in introducing new patterns into organizations. Linda Rising is an independent consultant who has worked on several books dealing with software design patterns.

With a nod to Christopher Alexander, the authors set out to identify and discuss 48 patterns for introducing change. These are not deep structural patterns. They are more along the lines of Ask for Help, Do Food, and Whisper in the General's Ear. The authors discuss these patterns and provide examples. The book is an easy read, but well worth the effort if you have ideas you hope to get across.


Software Endgames -- Eliminating Defects, Controlling Change, and the Countdown to On-Time Delivery by Robert Galen (Dorset House, New York NY, 2005, 328pp, ISBN 0-932633-62-5, www.dorsethouse.com, $39.95)

This book does not use the language of patterns, but it deals with an area of software development that could certainly use some good patterns. Galen defines the endgame as the time between release of the product to the testers and release to customers. This can be a harrowing time, full of traps and pitfalls. Galen calls on his 25 years experience to provide practical strategies for dealing with the situations that arise.

Galen starts his book by citing two of Jim McCarthy's maxims from Dynamics of Software Development (see Micro Review, Sept/Oct 1997): 
  • Triage ruthlessly
  • Don't shake the Jell-O 
Perhaps you could call these patterns. The first asks you to develop excellent judgment about which defects are worth fixing. The second asks you to develop a horror of changing anything that doesn't need to change. As Galen puts it, "triage and change management are central to a successful exit from the endgame."

This book is a little longer and more detailed than the typical Dorset House book, but the subject warrants it. If you get one good idea out of this book, it could save your company.


Working Effectively with Legacy Code by Michael Feathers (Prentice Hall, Upper Saddle River NJ, 2005, 456pp, ISBN 0-13-117705-2, www.phptr.com, $44.99)

If the endgame seems harrowing, it's nothing when compared to the problems of dealing with legacy code. Nobody wants to touch it, but what do you do if you have to?

Michael Feathers works with Object Mentor, where he teaches classes in many aspects of software development. This book grew out of some of those classes.

As Robert Martin writes in the foreword, dealing with legacy code is like removing rot or reversing entropy. These are difficult tasks for which there are no magic bullets. Feathers provides strategies, but you can follow them with all the best intentions and still get into big trouble. Still, if you have to go into the jungle, it's good to have a guide.

Feathers starts with a brief discussion of principles. The bulk of the book -- about 90% -- is a set of short essays focused on specific problems that you might face. He addresses nitty-gritty issues such as what to do if you find yourself making the same change in many different places.

If you don't have to deal with legacy code, consider yourself lucky. If you do, you'll probably find this book helpful.

 
Miscellany

A Semantic Web Primer by Grigoris Antoniou & Frank van Harmelen (MIT, Cambridge MA, 2004, 258pp, ISBN 0-262-01210-3, mitpress.mit.edu, $40.00)

The semantic web is a term that encompasses a variety of efforts to make information in websites more easily read by machines. Search engines like Google make the web usable, but they often return both too many and too few references. Lots of barely relevant information may come back to you, while highly relevant nuggets remain hidden.

While huge amounts of information about the semantic web are freely available online, Antoniou and Harmelen have put together a concise introduction that emphasizes the resource description framework (RDF), its associated RDF schema, and the web ontology language, called OWL -- no doubt in homage to A. A. Milne's Owl, who spelled his name WOL.

The book starts from the basics, but parts of it are fairly technical. Some aspects of knowledge management are difficult, but the authors do not shy away from them. If you want to know about the semantic web, this is a good place to start.


Mind Hacks -- Tips and Tools for Using Your Brain by Tom Stafford and Matt Webb (O'Reilly, Sebastopol CA, 2004, 394pp, ISBN 0-596-00779-5, www.oreilly.com, $24.95)

This is a very interesting book, but it's a stretch to include it in the O'Reilly Hacks series. The authors have dutifully broken down their subject matter into 100 relatively independent essays, but it might fit better into a more traditional presentation.

Tom Stafford is a psychologist. Matt Webb is an engineer. They are British, as are nearly all of the 18 people they list as contributors. They refer to the subject matter of their book as recreational neuroscience. They provide a collection of optical illusions, puzzles, and sensory-motor experiments that you can use to gain greater insight into how your brain and nervous system work. 

The authors follow a pattern for each hack. They talk about the general area. Then they tell you what to do. Finally, they tell you about the underlying mechanism. It may not have much to do with hacking, but it's fun and informative.