TheUnix philosophy, originated byKen Thompson, is a set of cultural norms and philosophical approaches tominimalist,modularsoftware development. It is based on the experience of leading developers of theUnixoperating system. Early Unix developers were important in bringing the concepts of modularity and reusability into software engineering practice, spawning a "software tools" movement. Over time, the leading developers of Unix (and programs that ran on it) established a set of cultural norms for developing software; these norms became as important and influential as the technology of Unix itself, and have been termed the "Unix philosophy."
The Unix philosophy emphasizes building simple, compact, clear, modular, andextensible code that can be easily maintained and repurposed by developers other than its creators. The Unix philosophy favorscomposability as opposed tomonolithic design.
The Unix philosophy is documented byDoug McIlroy[1] in theBell System Technical Journal from 1978:[2]
It was later summarized byPeter H. Salus in A Quarter-Century of Unix (1994):[1]
In their Unix paper of 1974, Ritchie and Thompson quote the following design considerations:[3]
In their preface to the 1984 book,The UNIX Programming Environment,Brian Kernighan andRob Pike, both fromBell Labs, give a brief description of the Unix design and the Unix philosophy:[4]
Even though the UNIX system introduces a number of innovative programs and techniques, no single program or idea makes it work well. Instead, what makes it effective is the approach to programming, a philosophy of using the computer. Although that philosophy can't be written down in a single sentence, at its heart is the idea that the power of a system comes more from the relationships among programs than from the programs themselves. Many UNIX programs do quite trivial things in isolation, but, combined with other programs, become general and useful tools.
The authors further write that their goal for this book is "to communicate the UNIX programming philosophy."[4]
In October 1984, Brian Kernighan and Rob Pike published a paper calledProgram Design in the UNIX Environment. In this paper, they criticize the accretion of program options and features found in some newer Unix systems such as4.2BSD andSystem V, and explain the Unix philosophy of software tools, each performing one general function:[5]
Much of the power of the UNIX operating system comes from a style of program design that makes programs easy to use and, more important, easy to combine with other programs. This style has been called the use ofsoftware tools, and depends more on how the programs fit into the programming environment and how they can be used with other programs than on how they are designed internally. [...] This style was based on the use oftools: using programs separately or in combination to get a job done, rather than doing it by hand, by monolithic self-sufficient subsystems, or by special-purpose, one-time programs.
The authors contrast Unix tools such ascat with larger program suites used by other systems.[5]
The design ofcat is typical of most UNIX programs: it implements one simple but general function that can be used in many different applications (including many not envisioned by the original author). Other commands are used for other functions. For example, there are separate commands for file system tasks like renaming files, deleting them, or telling how big they are. Other systems instead lump these into a single "file system" command with an internal structure and command language of its own. (ThePIP file copy program[6] found on operating systems likeCP/M orRSX-11 is an example.) That approach is not necessarily worse or better, but it is certainly against the UNIX philosophy.
McIlroy, then head of the Bell Labs Computing Sciences Research Center, and inventor of theUnix pipe,[7] summarized the Unix philosophy as follows:[1]
This is the Unix philosophy: Write programs that do one thing and do it well. Write programs to work together. Write programs to handletext streams, because that is a universal interface.
Beyond these statements, he has also emphasized simplicity andminimalism in Unix programming:[1]
The notion of "intricate and beautiful complexities" is almost an oxymoron. Unix programmers vie with each other for "simple and beautiful" honors — a point that's implicit in these rules, but is well worth making overt.
Conversely, McIlroy has criticized modernLinux as havingsoftware bloat, remarking that, "adoring admirers have fed Linux goodies to a disheartening state ofobesity."[8] He contrasts this with the earlier approach taken at Bell Labs when developing and revisingResearch Unix:[9]
Everything was small... and my heart sinks for Linux when I see the size of it. [...] Themanual page, which really used to be a manualpage, is now a small volume, with a thousand options... We used to sit around in the Unix Room saying, 'What can we throw out? Why is there this option?' It's often because there is some deficiency in the basic design — you didn't really hit the right design point. Instead of adding an option, think about what was forcing you to add that option.
As stated by McIlroy, and generally accepted throughout the Unix community, Unix programs have always been expected to follow the concept of DOTADIW, or "Do One Thing And Do It Well." There are limited sources for the acronym DOTADIW on the Internet, but it is discussed at length during the development and packaging of new operating systems, especially in the Linux community.
Patrick Volkerding, the project lead ofSlackware Linux, invoked this design principle in a criticism of thesystemd architecture, stating that, "attempting to control services, sockets, devices, mounts, etc., all within onedaemon flies in the face of the Unix concept of doing one thing and doing it well."[10]
In his bookThe Art of Unix Programming that was first published in 2003,[11]Eric S. Raymond (open source advocate and programmer) summarizes the Unix philosophy asKISS Principle of "Keep it Simple, Stupid."[12] He provides a series of design rules:[1]
In 1994,Mike Gancarz, a member ofDigital Equipment Corporation's Unix Engineering Group (UEG), publishedThe UNIX Philosophy based on his own Unix (Ultrix) port development at DEC in the 1980s and discussions with colleagues. He is also a member of theX Window System development team and author ofUltrix Window Manager (uwm).
The book focuses on porting UNIX to different computers during theUnix wars of the 1980s and describes his philosophy that portability should be more important than the efficiency of using non-standard interfaces for hardware and graphics devices.
The nine basic "tenets" he claims to be important are
This sectiondoes notcite anysources. Please helpimprove this section byadding citations to reliable sources. Unsourced material may be challenged andremoved.(February 2024) (Learn how and when to remove this message) |
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 attributes 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 used amonolithic 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-termI/O in the kernel, the handling of the situation was unclear. The signal handler could not be executed when the process was in kernel mode, with sensitive kernel data on the stack.
In a 1981 article entitled "The truth about Unix:The user interface is horrid"[13] published inDatamation,Don Norman criticized the design philosophy of Unix for its lack of concern for the user interface. Writing from his background in cognitive science and from the perspective of the then-current philosophy ofcognitive engineering,[14] he focused on how end-users comprehend and form a personalcognitive model of systems—or, in the case of Unix, fail to understand, with the result that disastrous mistakes (such as losing an hour's worth of work) are all too easy.
In the podcast On the Metal, game developerJonathan Blow criticised UNIX philosophy as being outdated.[15] He argued that tying together modular tools results in very inefficient programs. He says that UNIX philosophy suffers from similar problems tomicroservices: without overall supervision, big architectures end up ineffective and inefficient.