Review of Kernighan and Pike's New Book
Mike O'Dell
mo at seismo.UUCP
Mon Dec 12 14:54:12 AEST 1983
Review of "The UNIX Programming Environment" by
Brian Kernighan and Rob Pike
Prentice-Hall Software Series
Copyright 1984 Bel Telephone Laboratories
(Available in bookstores now, in spite
of copyright date.)
Reviewer: Mike O'Dell
mo at lbl-csam, lbl-csam!mo, seismo!mo
"The UNIX Programming Environment" is book long overdue
and badly needed. In this one place, you can find out "How to
Write Good" in the Unix world. I recently saw a Letter-to-the-Editor
of some trade rag effusing over how the Pick OS is better than Unix
because in Pick you never have to write a program, while in Unix
you always have to write a program (distinct implication was "in C").
If there ever was a rebuttal to that miscomprehension, this book is it.
This book spans an amazing range of topics: it contains
a VERY good upgrade of the "Unix for Beginners" chapter, and then
proceeds to demonstrate just how much work can be done on Unix,
even if the C compiler has been removed from the system. The treatment
of shell programming (Bourne shell) is gradual and impressive.
It shows the sheer power and elegance of Unix, while at the same time,
not being coy about pointing out the occassional warts. From simple
one-liners to embrionic SCCS-type tools, the reader learns the
skills necessary to truly exploit the powerful programming language
that is the shell. After mastering the shell, the discourse moves
to things which really need C, and how to write them well.
Design issues, coding hints, good practices, there is a wealth of
information here. Starting with "cat" (Hello, Toronto!) which does
all (only?!) the right things without needing flags, to a full-fledged
interpreted programming language, here is a course in software
engineering using power tools, instead of hammer-and-tongs.
All along the way, things are built gradually, reusing previous pieces
instead of starting from a blank sheet of paper. This book should
be read at the terminal, doing the exercises right along.
The reviewer has been thinking a great deal about the audience of this
book. It is purest platinum for the programmer who while competent,
is new to Unix and the Unix world view. Unix is a powerful environment
and learning to use it effectively and harmoniously can sometimes
go awry directly because the power and flexibility often make it almost as easy
to do things wrong as right. Moreover, most programmers, even and
especially many practicing Unix programmers, tend to think of solving
problems by writing programs. This is to be encouraged; the problem,
however, is people often start writing in the wrong language (frequently
"C"). There are in fact many jobs which need programs to do them,
but if your view of "how to get the job done" isn't altered by
this text either you are already Genuinely Enlightened or you have
probably missed the point. (There are indeed sublte points along the way.)
While the book is well written and an interesting philosphical discourse,
there are points the reviewer differs with, and no doubt, any reader
will occassionally disagree with the authors. But that too is valuable.
Thoughtful introspection is good for the soul, and gets one away
from the terminal as well.
Finally, I heartily commend this book to anyone wanting to Truly Know Unix;
it ain't perfect, but it is enlightening. I particularly recommend
it to persons responsible for influencing the direction of the system
outside the BTL research group. If you ever wondered about the
"intent", you wil probably never see it spelled out as well
anywhere else. Finally, anyone attempting to "enhance" Unix for
whatever reason or application should read this book. Before you
can enhance it, you have to know what is REALLY there and what
is NOT broken.
Annotated Top-level Table of Contents:
1. UNIX for Beginners
Well re-written; deals well with the issue
of local system conventions for erase, kill, etc.
2. The File System
What it does and doesn't do, and why that is important.
3. Using the Shell
Intro to Metacharacters, I/O redirection, pipes, etc.
4. Filters
grep, sed, awk and company
5. Shell Programming
Production-quality shell scripts
6. Programming with Standard I/O
Intro to the Standard I/O library ("C" obviously)
7. UNIX System Calls
Low-level I/O, processes, signals, etc.
8. Program Development
From a four-function calculator to an almost-Basic
in 6 Easy Lessions
9. Document Preparation
Meet -ms and troff
10. Epilog
Appendix 1: ed summary
Appendix 2: "hoc" manual page
Appendix 3: "hoc" source code listing
More information about the Comp.unix.wizards
mailing list