Reality Check

Dr. Dobb's Journal July, 2004

By Gregory V. Wilson and John Gilhuly

Greg is a DDJ contributing editor. He and John are developers for Hewlett-Packard and can be contacted at gvwilson third-bit.com.

Extreme Programming Refactored: The Case Against XP
Matt Stephens and Doug Rosenberg
APress, 2003
432 pp., $39.99
ISBN 1590590961

Refactoring Workbook
William C. Wake
Addison-Wesley, 2004
224 pp., $34.99
ISBN 0321109295

Bug Patterns in Java
Eric Allen
APress, 2002
234 pp., $34.95
ISBN 1590590619

Python Programming For the Absolute Beginner
Michael Dawson
Premier Press, 2003
400 pp., $29.99
ISBN 1592000738

For those of you who haven't been paying attention, there's a new methodology on the block named "eXtreme Programming." It's brash, it's bold, and it's very noisy: There are several dozen books about it, plus conferences, training courses, T-shirts, and even earrings.

What there hasn't been is a critical assessment of whether or not XP actually works. Its inventors believe it does, but the inventors of every other programming methodology in the last 40 years have been equally ardent fans of their own work. The real test is how XP works in the hands of programmers who aren't true believers, and who don't have the deep understanding of object-oriented programming patterns, or the monk-like self discipline, of XP's early adopters.

Extreme Programming Refactored, by Matt Stephens and Doug Rosenberg is, therefore, very timely. After publishing a pair of essays critical of XP, Stephens and Rosenberg received a flood of "me, too" messages from programmers who'd had "through the looking glass" experiences with XP. That prompted them to write this bitingly satirical book, complete with mangled Beatles lyrics and hilarious (but depressing) quotes from XP luminaries:

I think maybe concentration is the enemy. Seriously. If you're working on something that is so complex that you actually need to concentrate, there's too much chance that it's too hard.
—Ron Jeffries

The result is far from even-handed. Stephens and Rosenberg are as passionate in their dissection of XP's unproven assumptions and circular reasoning as its advocates are in praising its supposed benefits. But it's well written, carefully researched, and fun to read, although the sarcasm is a little thick in places. If you are thinking of giving XP a try, or if your manager has just come back from a trade show all fired up about this particular silver bullet, XPR should definitely be on your New Year's reading list.

The second entry on this month's list, William Wake's Refactoring Workbook, isn't nearly as much fun as XPR, but is at least as valuable. Refactoring means reorganizing and cleaning up code; it is one of XP's core practices, but everyone maintaining or extending software needs to do it from time to time. Wake's Workbook summarizes common refactoring patterns, then presents exercises so that readers can test their understanding. The exercises are all in Java, but the ideas are universal: removing duplication, simplifying conditional logic, rationalizing class hierarchies, and so on.

As an occasional teacher of undergraduate programming courses, I think this book is worth its weight in platinum. Showing students something bad, and how to clean it up, is a very effective way to teach good programming style. I have an entire pack of yellow sticky notes stuck into the pages of this book, and will be lifting material from it liberally in my next course.

Eric Allen's Bug Patterns in Java is also a worthy book, but not as useful as its title suggests. The first six chapters discuss the nature of bugs and their relationship to the software-development process. Chapters 7 through 19 then examine several species of bugs that crop up repeatedly: null pointers, misleading views, orphaned threads, and so on. These are all good to know, but I felt that Allen spent more time on each than they deserved, while not including many others that are (in my experience) more common. Don't get me wrong: I'm a fan of pattern catalogs, especially as a teaching aid. However, I think this would be a stronger book if it gave twice as many bugs half as much space each.

—Gregory Wilson

Michael Dawson's Python Programming for the Absolute Beginner strives to teach you not only Python, but also pseudocode, object-oriented programming, and good programming techniques through the development of simple games. The book begins with displaying a simple "Game Over" message and slowly builds up from text-based games to a full- featured version of Asteroids.

The greatest flaw of the book is its pace. Readers who want to learn how to create games will want to play with their creations. In this book, the first playable game is Hangman in Chapter 5, and it takes three hundred pages for the author to introduce the concept of a graphical user interface. What's more, the author doesn't assume that you have learned anything while reading his book: He takes the same carefully measured approach to explaining code segments in the later chapters as he does at the beginning.

— John Gilhuly

DDJ