DDJ书评（2003.11):Unix Zen and Now(有 The Art of Unix Programming)
Copyright (C) Dr. Dobb's Journal, November, 2003
The white-robed roshi and juvenile shaved-head monk on the cover suggest that Eric Raymond probably intended to call his book “The Zen of UNIX Programming.” Cooler editorial heads prevailed and we ended up with The Art of UNIX Programming.
Though Raymond covers everything from operating-system origins (including IBM/VM and DEC VMS) and HTTP, C, Lisp, and C++, to Docbook and CVS (and every blessed thing beyond and between), The Art of UNIX Programming is not a tutorial.
Raymond rambles through a bizarre exposition of what he finds to be the “kozmik trooths” of the UNIX programming environment. If you’re actually trying to learn UNIX programming, this is the wrong book. To the extent the book has focus, the focus is something like this:
Eric drove the Reader’s chariot out onto the Field of UNIX. They stood for a while between the two armies of the Ideal and the Necessary. The Reader threw down his keyboard and said, "I shall not fight!" Eric then expounded the True Nature of the Programming Field, the Knower and the Known. The Reader, now wiser, picked up his keyboard afresh and coded on.
In case you think I’m stretching the point, here are a few headings—just a few, mind you—to give you some of the savor of the opus:
- TCP/IP and the UNIX Wars: 1980–1990
- Blows Against the Empire: 1991–1995
- Case Study: C Considered as Thin Glue
- Security Wrappers and Bernstein Chaining
- Case Study: Metaclass Hacking in fetchmailconf.
- The “Separated Engine and Interface” Pattern
- The Present Chaos and the Possible Way Out
The book is always informative, albeit in a patchwork fashion. Raymond palms off metaphysics as computer science and confounds aesthetics with epistemology as well as any of us FORTH programmers did a couple of decades ago. He also manages to broaden the reader’s perspective, in a critique that sports a literary sheen. It would be a more intellectually uplifting workplace if more gifted programmers were as erudite as Raymond, though it is possible in that case that less actual work would be performed.
The Art of UNIX Programming settles down around Chapter 14 (Languages) or 15 (Tools), and starts giving some practical programming advice. In this book much is true and much is good. The reading of it does serve to stimulate the imagination and the pride of communal ownership of the UNIX Ideal.
In contrast, UNIX Systems Programming: Communication, Concurrency and Threads, by Kay Robbins and Steven Robbins, is not at all a fanciful book. It’s about How. To. Program. UNIX. Emphasis on multiprogramming.
UNIX Systems Programming is as dry as (or drier than) a Sun Microsystems manual, and typeset identical to Sun publications, just in case the point was otherwise missed. It’s the second edition of the 1995 opus Practical UNIX Programming: A Guide to Communication, Concurrency and Multithreading. We’re informed in the Preface that the title was changed “to better convey [sic] what the book was [sic] about.”
UNIX Systems Programming is nerdly arcana for corporate staff programmers. That’s why I was surprised the authors missed an important point about threading. Thread implementations are mined with guarantees that functions will appear in libraries whether they have the desired effect or not. The function pthread_attr_setschedpolicy() has tripped up programmers before: POSIX insists it appear in a compatible library without demanding that it actually perform its specified work. Solaris pthread programmers know to #ifdef for Solaris and use the nonportable platform function thr_setconcurrency().
UNIX Systems Programming is detailed, indexed, cross referenced, generally accurate, useful, enduring, attractive, and hardbound. If you do serious UNIX programming and do not yet have a complete overview of pipes and/or sockets and/or exec calls and/or POSIX threads, this book is a good bet, but a close perusal of your system manuals will still be necessary.
Absolute OpenBSD: UNIX for the Practical Paranoid, by Michael Lucas, is the book all newbies exploring one of the free or open-source community’s most secure and austere operating systems have long demanded. It is the “missing manual” to obtaining, installing, using, and administering OpenBSD. Much of this information can be gleaned from the FAQs at the OpenBSD web site (http://www.openbsd.org/) and all of it has been asked, over and over again, on the mailing lists. Absolute OpenBSD is nicely written, organized in the order newbies need during install, cleanly laid out, and well indexed. New users should buy the book at the same time they buy the OpenBSD distribution CD. Because, if it’s half as good as I’m saying it is, Absolute OpenBSD will save newbies weeks of anguished whining on the mailing lists.
The Art of UNIX Programming
Eric S. Raymond
512 pp., $39.99
UNIX Systems Programming: Communication, Concurrency And Threads, Second Edition
Kay A. Robbins and Steven Robbins
Prentice Hall, 2003
912 pp., $69.99
Absolute OpenBSD: UNIX for the Practical Paranoid
Michael W. Lucas
No Starch Press, 2003
600 pp., $39.95