The Art of UNIX Programming
by Branimir Res - Wednesday, 14 July 2004.
Author: Eric S. Raymond
Pages: 512
Publisher: Addison-Wesley
ISBN: 0131429019


Many books have been written about the UNIX operating system. Many of them are so-called cookbooks while others are packed with theoretical knowledge. This one is peculiar as it incorporates both types, packing the best material from each.

About the author

Eric S. Raymond has been a UNIX developer since 1982. Known as the resident anthropologist and rowing ambassador of the open source community, he wrote the movement's manifesto in "The Cathedral and the Baazar" and is the editor of "The New Hacker's Dictionary".

Inside the book

The book begins with some basic facts about UNIX. Raymond presents not only a historical view but also explains why UNIX is so popular in many environments and determines its weak points. He examines the raise of UNIX from the beginning in 1969, the days when hardware was still weak in performance. He then follows the UNIX Wars and the dark time where UNIX was almost terminated and then reborn in new light as Linux and free UNIX. And here we find some simple but powerful rules about UNIX. Like the Pean axioms in mathematics we can use this rules as a good base for building a giant like UNIX or a UNIX like OS. The rules are well explained and the author complements them with various examples. These are the rules which teach us good logic in UNIX programming and UNIX thinking at all. As UNIX lovers say - "Keep it simple stupid" the well known KISS principle.

The last chapter in the first part of the book covers a comparison between UNIX and other operating systems popular not only today but also in the past (VMS, MS Windows, BeOS, MacOS, OS/2, MVS,VM/CMS). Raymond illustrates some common but important things about these operating systems and then he examines them.

What follows is a discussion on modularity in writing code. We always try to keep the code simple, make it modular, but that's not easy as it sounds. Introduced here are terms like compactness, orthogonality and the SPOT rule (Single spot of Truth). There's also a discussion on the top-down and vice versa method and the author also presents two case studies with real-life examples.

As we move on you learn about protocols, text formats and other formats found in operating systems. Data file meta formats - DSV, MIME, cookies, XML and Windows INI formats are well explained here. There is an illustration of application protocol design through case studies (POP3, IMAP) and application protocol meta formats (IPP,CDDB/

Transparency is important. Why? Simply because programming is complex enough and if your code is dirty, in a few weeks time you may not know what you were thinking when writing the code. Transparency is a passive quality. As always here you encounter many examples that explain very well in theory what you read.

Communication between modules, well known words like IPC, pipes, redirections, sockets, shared memory, streams, RPC and threads are the basic idea behind the chapter entitled "Multiprogramming" which can also be called multiprocessing, just don't confuse this term with the term used for the hardware implementation of two or more CPUs.

Next Raymond dwells into the world of scripting utilities, or should I say mini languages as he writes about awk, sed, make, etc. He explains clearly when to use and when not to use these utilities.

We all know that in most cases data is easier to follow then the process is logic. That's explained in data driven programming with some real world examples.

The authors continues by touching the issues surrounding configurability by introducing the reader to startup files, command line options as well as portability to different UNIX systems. Next you spend some time in user-interface sphere where you can read interesting case studies.

Optimization is important but it's not as simple as many programmers think. It's a valuable asset if you are knowledgeable about hardware implementations and knowing the operational cost of the code you write.

The second part of the book concludes with a discussion on complexity. You may ask yourself: "How can I write complex and simple programs?" It all depends on the situation and Raymond provides you with some intuitive guidelines.

The third part of this title, entitled Implementation, comes with a presentation of programming languages. C, C++, Java, Pyton, Perl, Tcl and others are the main competitors. Every language has its advantages and disadvantages which are explained very well. I'm sure this chapter will help you decide on what language to use for a specific job.

Another good lesson that the author provides is - reuse code. Do not reinvent code that has been developed a long time ago. This concept leads to open source licensing and the idea of reusing code.

We know UNIX is a versatile operating system so no wonder Raymond provides some details about UNIX portability. There is a note about portability on other languages and standards in UNIX (BSD, AT&T, POSIX, Open Group, Open Source, etc.)

Next comes the documentation. Without documentation UNIX or any other operating system would be just a black box, impossible to discover. Here you find descriptions on traditional utilities and formats, as well as recommendations for writing good documentation.

Raymond continues with a summary of what open source means today. But wait, this is not an ode to the open source community but rather a cookbook with good recipes for the implementation of open source programs or code. There are also recommendations for choosing an open source licensing module.

The closing chapter of the book contains thoughts on the future of UNIX. What is weakness of the UNIX philosophy? What can we do better?

Final thoughts

I'll put the answer in simple mode - this is the Bible for people who regard UNIX as a religion or philosophy. This title is definitely not aimed at an beginner audience although those will less knowledge will benefit from keeping it on their bookshelf, they'll just have to read it more than once to grasp all the presented material.

I specially love the fact that the author was very clear and objective in his words during the entire book. I'll quote one cookie: "UNIX is user friendly, it's just choosy about who its friends are."


Critical bug found in Cisco ASA products, attackers are scanning for affected devices

Several Cisco ASA products - appliances, firewalls, switches, routers, and security modules - have been found sporting a flaw that can ultimately lead to remote code execution by attackers.

Weekly newsletter

Reading our newsletter every Monday will keep you up-to-date with security news.

Daily digest

Receive a daily digest of the latest security news.

Fri, Feb 12th