|
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. 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 is usually severely abridged to "Do one thing, do it well." Of the three tenets, only the third is specific to Unix, though Unix developers often emphasized all three tenets more than other developers. Pike: Notes on Programming in C Rob Pike offers the following "rules" in ''Notes on Programming in C'' as programming maxims, though they can be easily viewed as points of a Unix philosophy: Pike's rules 1 and 2 restate Tony Hoare's famous maxim "Premature optimization is the root of all evil." Ken Thompson rephrased Pike's rules 3 and 4 as "When in doubt, use brute force." Rules 3 and 4 are instances of the design philosophy KISS. Rule 5 was previously stated by Fred Brooks in The Mythical Man-Month. Rule 5 is often shortened to "write stupid code that uses smart data", and is an instance of the guideline "If your datastructures are good enough, the algorithm to manipulate them should be trivial." Hans Reiser expressed this as " A naming system should reflect rather than mold structure." Rule 6 is from the Bruces sketch from Monty Python's Flying Circus, or may be an example of ''ha ha only serious'', implicitly limiting the number of rules (see KISS principle). Mike Gancarz: The UNIX Philosophy In 1994 Mike Gancarz (a member of the team that designed the X Window System), drawing 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 into 9 paramount precepts: The 10 lesser tenets are ones which are not universally agreed upon as part of the Unix philosophy, and in some cases, are hotly debated (Monolithic kernel vs. Microkernels): Worse is better Main article: Worse is better Richard P. Gabriel suggests that a key advantage of Unix was that it embodied a design 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. 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, such as sleep (10 In these cases Ken Thompson and Dennis Ritchie favored simplicity over perfection. The UNIX system would occasionally return early from a system call with an error stating that it had done nothing - the "Interrupted System Call" - an error number 4 (EINTR) in today's systems. Of course the call had been aborted in order to call the signal handler. This could only happen for a handful of long-running system calls, i.e. read(), write(), open(), select(), etc. On the plus side, this made the I/O system many times simpler to design and understand. The vast majority of user programs were never affected because they didn't handle or experience signals other than SIGINT/^C and would die right away if one was raised. For a very few number of programs - things like shells or text editors - that respond to job control keypresses - these programs could put small wrappers on their system calls and retry the call right away if this EINTR error was raised. Problem solved, in a simple way. 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, although unsurprisingly it is not difficult to find severe violations of most of the following in actual Unix practice: Many of these norms are accepted outside of the Unix community — if not when Unix first used them, then later on. Also, many were not unique or original to the Unix community. Nevertheless, adepts at Unix programming tend to accept a combination of these ideas as the foundation of the Unix style. Controversy Because of the Unix Philosophy, for much of UNIX's early years it was the OS that crashed several times every day, while also being the OS with the shortest reboot times. Sun workstations (as in some of The UNIX-HATERS Handbook tales), PDP-11/45 Version 6 Unix|Unix v6 or PDP 11/70 Version 7 Unix|v7, or what?) It is controversial as to whether FSF/RMS's GNU work-alikes of standard Unix programs (such as diff, find, etc) follow the "Unix Philosophy" or misunderstand it. Certainly at least some Unix old timers claim the latter, since GNU tools are often substantially more featureful than their Unix equivalents. Quotes See also Notes | |||||||
|
| ||||||||
![]() |
|
| |