DDJ书评（2004.2)：Small Is Still Beautiful（有Pramatic系列哦）
Copyright (C) Dr. Dobb's Journal, February, 2004
Time to confess: I prefer small books to large ones. In part, it's because my back is getting old and doesn't enjoy lugging 1200-page tomes around. The real reason, however, is that a book is supposed to be a conversation between the author and the reader, and who wants to hang out with anyone who is 1200 pages worth of long-winded?
Andy Hunt and Dave Thomas's two new books are therefore doubly welcome. Not only are they well-written and informative, they are also blessedly short. The first, Pragmatic Unit Testing: In Java with JUnit, tells you everything you need to start testing your Java programs efficiently. The second, Pragmatic Version Control: Using CVS, covers the basics of CVS, and explains how to use it for both personal and team projects. Their exposition and examples are as clear as those in the duo's first book, The Pragmatic Programmer (reviewed here in March 2000), and the pragmatism of the titles can be found on every page. If you understand loops and classes, and are wondering what to learn next, you need look no further than these two books.
Elliotte Rusty Harold's Effective XML: 50 Specific Ways to Improve Your XML is just as practical a book, although you will have to work a little harder to put its advice into practice. His previous book, Processing XML with Java (reviewed here in July 2003), told you everything you would ever need to know about how to deal with XML programmatically. This book looks at XML itself; in particular, it explains which of XML's many features should be used when. For example, Item 12 tells you to store metadata in attributes, then spends six pages explaining why. Item 24 analyzes the strengths and weaknesses of various schema languages (the W3C's XML Schema, DTDs, Schematron, and Relax NG), while Item 38 covers character set encodings. It's all very useful, opinionated, and well informed.
Like Effective XML, Elfriede Dustin's Effective Software Testing: 50 Specific Ways to Improve Your Testing is another entry in Addison-Wesley's growing "Effective" series. It contains a lot of useful ideas, but isn't as directly applicable as Harold's or the Hunt and Thomas pair. The primary reason is that processes (including testing) are intrinsically harder to explain in concrete terms than APIs or data formats.
Mark Graff and Kenneth van Wyk's Secure Coding: Principles and Practices is another good book with the same problem. I have spent most of the last four years working on an access-control and identity-management product, which has made me painfully aware of just how insecure the average program is. Graff and van Wyk offer a lot of useful advice for programmers who want to know what they should be doing, but as with Dustin's book, most of it will be hard for newcomers to the field to translate into practice. "Be kind to maintainers" and "Don't trust web URLs" are good tips, but what exactly do they mean in practice? To be fair, the authors do provide a few snippets of sample code, such as a restricted shell for sendmail, but many more are needed.
The last book on this month's list is David Brackeen's Developing Games in Java. At 970 pages, I'm sure that better page design could have cut its length by a third. That said, I was impressed by how much Brackeen manages to cover, and how well he covers it. The book is clearly aimed at young programmers who know just enough Java to get themselves in trouble. Brackeen patiently works through everything such readers need to know to start building modern multiplayer games, including threading, Swing user interfaces, 3D graphics, and so on. By the midpoint of the book, he is discussing game physics and artificial intelligence; by its end, he is pointing readers at performance profiling and Java Web Start. While it's obviously impossible to do any of these topics real justice in a chapter each, Brackeen does explain the key ideas and show how they relate to one another. If the University of Toronto would let me teach an undergraduate course on game programming, I would probably use this as a textbook.
Pragmatic Unit Testing: In Java with JUnit
Andy Hunt and Dave Thomas
The Pragmatic Programmers, 2003
138 pp., $29.95
Pragmatic Version Control: Using CVS
Dave Thomas and Andy Hunt
The Pragmatic Programmers, 2003
159 pp., $29.95
Effective XML: 50 Specific Ways to Improve Your XML
Elliotte Rusty Harold
304 pp., $44.99
Effective Software Testing: 50 Specific Ways to Improve Your Testing
271 pp., $34.99
Secure Coding: Principles and Practices
Mark G. Graff and Kenneth R. van Wyk
O'Reilly & Associates, 2003
202 pp., $29.95
Developing Games in Java
New Riders, 2004
972 pp., $49.99