From Wikipedia, the free encyclopedia
The Unix philosophy is a set of cultural norms and philosophical approaches to developing software based on the experience of leading developers of the Unix operating system.
1 McIlroy: A Quarter Century of Unix
2 Eric Raymond
3 Mike Gancarz: The UNIX Philosophy
4 Worse is better
6 See also
9 External links
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 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 isusually abridged to "Write programs that do one thing and do it well".
Eric S. Raymond, in his book The Art of Unix Programming, summarizes the Unix philosophy as the widely-used KISS Principle of "Keep it Simple, Stupid". He also provides a series of design rules:
Rule of Modularity: Write simple parts connected by clean interfaces.
Rule of Clarity: Clarity is betterthan 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 forvisibility 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 ofRepair: 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".
Ruleof Extensibility: Design for the future, because it will be here sooner than you think.
Mike Gancarz: The UNIX Philosophy
In 1994 Mike Gancarz (a member of the team that designed the X Window System), drew on his own experience with Unix, as well as discussions with fellow programmers and people in other fields who depended on Unix, to produce The UNIX Philosophy which sums it up in 9paramount precepts:
Small is beautiful.
Make each program do one thing well.
Build a prototype as soon as possible.
Choose portability over efficiency.
Store data in flat text files.
Use software leverage to your advantage.
Use shell scripts to increase leverage and portability.
Avoid captive user interfaces.
Make every program a filter.
Worse is better
Main article: Worse isbetter
Richard P. Gabriel suggests that a key advantage of Unix was that it embodied a design philosophy he termed "worse is better", in which simplicity of both the interface and the implementation are 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 questionsthe quality of some results.
For example, in the early days Unix was a monolithic kernel (which means that user processes carried out kernel system calls all on the user stack). If a signal was delivered to a process while it was blocked on a long-term I/O in the kernel, then what should be done? Should the signal be delayed, possibly for a long time (maybe indefinitely) while the I/O completed?...