Chapter 5. Canonicality

image with no caption

It’s two hours before your demonstration for the Big Boss and one of the critical features isn’t working on your machine. This can’t be. It worked just last week on Bob’s machine. You go to Bob’s machine and, sure enough, it works beautifully. But some of the other features that work great on your machine don’t work on Bob’s machine. Now it’s time to panic.

Before long, the entire development team is standing around Bob’s machine, trying to figure out why what he’s building is different from what everyone else is building. Right before a major project milestone is the wrong (but inevitable) time for this to happen. It turns out that Bob has a newer version of a particular plug-in in his IDE and it changes the way the application runs in his environment. Of course, installing the same version of the plug-in on Bob’s machine breaks other stuff. You, Bob, and all your coworkers are suffering because you’re running more than one version of something important, which always gets out of sync.

A canonical representation refers to the simplest form without loss of information. Canonicality refers to the practice of eliminating duplication. In the seminal book The Pragmatic Programmer (Addison-Wesley), Andrew Hunt and David Thomas lay down the law: “Don’t repeat yourself” (DRY). This three-word sentence has profound effects on software development. Glenn Vanderburg calls ...

Get The Productive Programmer now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.