Book Reviews

Linux and the Unix Philosophy by Mike Gancarz

ISBN: 978-1555582739
Publisher: Digital Press; 2nd edition
Pages: 256

In many ways I was lucky. My first job was in a company basing their development and products on Unix. Thus, it was a natural step to use Linux at home for my own programming projects. I never reflected much on that decision. Fast forward ten years. I switched company and started development on a Windows-based platform. At that time I didn't know what to expect. How bad could it possibly get? Well, it turns out that most of the techniques, flexibility and simplicity I had taken for granted were gone. What used to be a few lines of a shell script transformed into a manual and expensive process. I learned the hard-way that an operating system is not just technique; when you choose technology, you also choose a community along with its unique culture and philosophy.

Mike Gancarz captures much of that culture and philosophy of Unix in his book. Though not obvious from the table of contents, I would like to see the book as three, distinct parts. The first part is organized around the tenets of Unix and Linux. This is also the most valuable part of the book. The second part is a comparison of Unix with the philosophies of other operating systems. It's interesting by providing some historical reflections. The final part tries to sell the Unix philosophy by relating it to "modern" practices and technologies. No matter how much I like the Unix way, this part is neither particularly convincing, nor is it accurate (for example, I would say that functional programming is a much better example on the Unix philosophy than the object oriented programming that Gancarz chooses).

So, let's focus on the strongest part of the book - the tenets of Unix. These have much wider application than Unix. Most, if not all, of the tenets are good principles and practices for software in general. It's when we start to combine the tenets that things get interesting. I particularly like the architectural discussions. Gancarz suggests a three-layered architecture. At the bottom, there are a set of small, independent programs. The second layer consists of an application layer that basically determines which functions are essential to the user by gluing together several of the small programs. Finally, the user layer is what the user sees as the application runs. And in a well-designed program, that could be either a command line or a GUI. The core idea is to allow different combinations based on application and user. Of course the user may be yet another program. By keeping the programs small (tenet 1) and making each program do one thing well (tenet 2), you've laid the foundation for software leverage (tenet 6).

Software leverage basically means re-use of existing modules and programs by new combinations. As Gancarz argues in tenet 7, shell scripts are an excellent mechanism to increase leverage and portability. Shell scripts is also an excellent way of eliminating repetitive work by automating the tasks. On Unix and Linux this is a natural solution. Unfortunately, I know from first-hand experience how painful it can be on other platforms. A few years ago, I did some code coverage analysis on a Windows application. The task consisted of four steps: build the system with coverage enabled, run the test-suits, collect the results and transform it to the desired presentation formats. On Unix, these tasks were a few simple targets in a makefile. On Windows, it proved impossible to automate because the development environment didn't expose a programmatic interface towards its analysis module. Thus, an excellent opportunity for software leverage was lost.

The discussion of software leverage is a highlight of the book and perhaps the most important point. Another useful discussion is the Three Systems of man. Here, Gancarz effectively argues that no matter how hard we try, we'll never build more than three systems. The First System usually results from a developer under pressure to meet a critical deadline. With his back against the wall, a creative spark is ignited. The First System is an exciting new concept. However, due to the constrains (usually time), it comes with a set of limitations. A group of experts set out to solve them, thereby developing the Second System. Gancarz argues that the Second System is always designed by a committee, leading to the expected bloat, or in Gancarz words, the second system is "fat and slow". Finally, a Third System is developed based on the experience from previous systems. Now, the original concept is regarded as obvious and well-understood. As a consequence, the Third System combines the best characteristics of previous generations and Gancarz discusses how to get to the Third System as soon as possible (an interesting side note is that Gancarz labels Linux as both a Second and a Third System).

Despite the flaws mentioned earlier, Linux and the Unix Philosophy is a great book. It's my belief that even experienced Unix and Linux developers will benefit from it; even if we know most of the principles and practices, Gancarz puts them in words and presents a holistic view. This one of the rare books I wish I read 15 years ago.

Reviewed April 2010