Professional Researcher's Encyclopaedia

Knowledge is only a click away

Unix philosophy - enyclopaedia article

Unix philosophy

Summary: The Unix philosophy is a set of cultural norms and philosophical approaches to developing software systems based on the experience of leading developers of the Unix operating system. Many individuals have examined these norms and tried to summarize them in some way. 1 McIlroy: A Quarter Century of Unix 2 Pike: Notes on Programming in C 3 Gabriel: Wors ...

read the full Unix philosophy article

Buy Unix philosophy related products:


Buy from Amazon.co.uk Books - Music - Classical - VHS - DVD - Video-games - Software - Electronics - Toys
Buy from Amazon.com Books - Music - Classical - VHS - DVD - Videogames - Software - Electronics - Photo - Toys
Buy from Amazon.ca Books - Music - Classical - VHS - DVD - Video-games - Software - Livres en Français
Buy from Amazon.de - - - - - - -
Buy from Amazon.fr - - - - -
Advanced Product Search (new):    uk    |     us    |     ca    |     de    |     fr

Unix philosophy

     From Wikipedia, the free encyclopedia.

The Unix philosophy is a set of cultural norms and philosophical approaches to developing software systems based on the experience of leading developers of the Unix operating system. Many individuals have examined these norms and tried to summarize them in some way.

Table of contents
1 McIlroy: A Quarter Century of Unix
2 Pike: Notes on Programming in C
3 Gabriel: Worse is Better
4 Raymond: The Art of Unix Programming
5 References
6 See also

McIlroy: A Quarter Century of Unix

Doug McIlroy, the inventor of Unix pipes and one of the founders of the Unix tradition, summarized the philosophy in Peter H. Salus' A Quarter Century of Unix as follows:

"This is the Unix philosophy: Write programs that do one thing and do it well.
Write programs to work together.
Write programs to handle text streams, because that is a universal interface."
This has been summarized as "Do one thing, do it well."

Pike: Notes on Programming in C

Rob Pike, a leading expert on applying the C programming language, offers the following "rules" in Notes on Programming in C as programming maxims (but they can be easily viewed as points of a Unix philosophy):

  • Rule 1. You can't tell where a program is going to spend its time. Bottlenecks occur in surprising places, so don't try to second guess and put in a speed hack until you've proven that's where the bottleneck is.
  • Rule 2. Measure. Don't tune for speed until you've measured, and even then don't unless one part of the code overwhelms the rest.
  • Rule 3. Fancy algorithms are slow when n is small, and n is usually small. Fancy algorithms have big constants. Until you know that n is frequently going to be big, don't get fancy. (Even if n does get big, use Rule 2 first.)
  • Rule 4. Fancy algorithms are buggier than simple ones, and they're much harder to implement. Use simple algorithms as well as simple data structures.
  • Rule 5. Data dominates. If you've chosen the right data structures and organized things well, the algorithms will almost always be self-evident. Data structures, not algorithms, are central to programming.
  • Rule 6. There is no Rule 6.
Pike's rules 1 and 2 restate Donald Knuth's famous maxim, "Premature optimization is the root of all evil." Ken Thompson rephrased Pike's rule 4 as "When in doubt, use brute force." Rule 5 was previously stated by Fred Brooks in The Mythical Man-Month.

Gabriel: Worse is Better

Richard P. Gabriel suggests that a key advantage of Unix was that it embodied a style of design (a philosophy) he termed Worse is better. In the "Worse is better" design style, simplicity of both the interface and the implementation is more important than any other attribute of the system — including correctness, consistency, and completeness. Gabriel argues that this design style has key evolutionary advantages, though he questions the quality of some results.

Raymond: The Art of Unix Programming

Eric S. Raymond, in his book The Art of Unix Programming, summarizes the Unix philosophy as the widely-used engineering philosophy, "Keep it Simple, Stupid" (KISS Principle). He then describes how he believes this overall philosophy is applied as a cultural Unix norm:

  • 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 to 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 Robustness: Robustness is the child of transparency and simplicity.
  • Rule of Representation: Fold knowledge into data so program logic can be stupid and robust.
  • Rule of Least Surprise: In interface design, always do the least surprising thing.
  • Rule of Silence: When a program has nothing surprising to say, it should say nothing.
  • Rule of Repair: When you must fail, fail noisily and as soon as possible.
  • Rule of Economy: Programmer time is expensive; conserve it in preference to machine time.
  • Rule of Generation: Avoid hand-hacking; write programs to write programs when you can.
  • Rule of Optimization: Prototype before polishing. Get it working before you optimize it.
  • Rule of Diversity: Distrust all claims for "one true way".
  • Rule of Extensibility: Design for the future, because it will be here sooner than you think.
Certainly many of these norms are accepted outside of the Unix community — if not when Unix first used them, at least later on. Also, many were not unique or originally appearing in the Unix community. Nevertheless, those who have learned to use Unix at master level tend to accept the combination of these ideas as being the foundation of the Unix style.

References

See also

link to this article with the following HTML

 
This article is from Wikipedia. This article was up-to-date as of 8 May 2004 - See live article
All text is available under the terms of the GNU Free Documentation License.

This page is part of Professional Researcher
Web site design by Dean Marshall