Friday, June 18, 2010

E-Book – The Art of Unix Programming

The Art of Unix Programming PDF
(2 MB)

Eric Raymond is a great author who is technical and yet funny, a rare combination. His book, The Art of Unix Programming, is filled with interesting tidbits about programming and the Unix culture.

Eric talks about mini-languages like Javascript, which is another name for “domain specific language”.

He has a number of rules which he explains in greater detail:

Rule of Modularity: Write simple parts connected by clean interfaces.
Rule of Clarity: Clarity is better than cleverness.
Rule of Composition: Design programs to be connected with other programs.
Rule of Separation: Separate policy from mechanism; separate interfaces from engines.
Rule of Simplicity: Design for simplicity; add complexity only where you must.
Rule of Parsimony: Write a big program only when it is clear by demonstration that nothing else will do.
Rule of Transparency: Design for visibility to make inspection and debugging easier.
Rule of Diversity: Distrust all claims for one true way.
Rule of Extensibility: Design for the future, because it will be here sooner

I chuckled when I read his opinion about Java.

“Java’s class-visibility and implicit-scoping rules are baroque. The interface facility avoids complex problems with multiple inheritance at the cost of being only slightly less difficult to understand and use in itself.”

And some of the funniest stuff is at the end of the book in appendix D, Rootless Root: The Unix Koans of Master Foo. While this koan isn't in the book, I found this one by googling "Master Foo and the End User". I laughed at this koan even though it bashes Windows.

Master Foo Discourses on Returning to Windows

A student said: “We have learned that Unix is not just an operating system, but also a style of approaching problems.”

Master Foo nodded in agreement.

The student continued: “Then, the Great Way of Unix can be applied on other operating systems?”

Master Foo sat silent for a moment, then said: “In every operating system there is a path to the Great Way, if only we can find it.”

The student continued: “What, then, of Windows? It is preinstalled on most computers, and though its tools are mostly far inferior, they are easy to use for beginners. Surely, Windows users could benefit from the Unix philosophy.”

Master Foo nodded again.

The student said: “How, then, are those enlightened in the Unix Way to return to the Windows world?”

Master Foo said: “To return to Windows, you have but to boot it up.”

The student said, growing agitated: “Master Foo, if it is so easy, why are there so many monolithic and broken software packages for Windows? Elegant software should also be possible with a GUI and fancy colors, but there is little evidence that this occurs. What becomes of an enlighted one who returns to Windows?”

Master Foo: “A broken mirror never reflects again; fallen flowers never go back to the old branches.”

Upon hearing this, all present were enlightened.

No comments: