Unix philosophy explained

The Unix philosophy, originated by Ken Thompson, is a set of cultural norms and philosophical approaches to minimalist, modular software development. It is based on the experience of leading developers of the Unix operating 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, and extensible code that can be easily maintained and repurposed by developers other than its creators. The Unix philosophy favors composability as opposed to monolithic design.

Origin

The Unix philosophy is documented by Doug McIlroy[1] in the Bell System Technical Journal from 1978:[2]

  1. Make each program do one thing well. To do a new job, build afresh rather than complicate old programs by adding new "features".
  2. Expect the output of every program to become the input to another, as yet unknown, program. Don't clutter output with extraneous information. Avoid stringently columnar or binary input formats. Don't insist on interactive input.
  3. Design and build software, even operating systems, to be tried early, ideally within weeks. Don't hesitate to throw away the clumsy parts and rebuild them.
  4. Use tools in preference to unskilled help to lighten a programming task, even if you have to detour to build the tools and expect to throw some of them out after you've finished using them.

It was later summarized by Peter H. Salus in A Quarter-Century of Unix (1994):

In their Unix paper of 1974, Ritchie and Thompson quote the following design considerations:

Parts

The UNIX Programming Environment

In their preface to the 1984 book, The UNIX Programming Environment, Brian Kernighan and Rob Pike, both from Bell Labs, give a brief description of the Unix design and the Unix philosophy:[3]

The authors further write that their goal for this book is "to communicate the UNIX programming philosophy."

Program Design in the UNIX Environment

In October 1984, Brian Kernighan and Rob Pike published a paper called Program Design in the UNIX Environment. In this paper, they criticize the accretion of program options and features found in some newer Unix systems such as 4.2BSD and System V, and explain the Unix philosophy of software tools, each performing one general function:[4]

The authors contrast Unix tools such as with larger program suites used by other systems.

Doug McIlroy on Unix programming

McIlroy, then head of the Bell Labs Computing Sciences Research Center, and inventor of the Unix pipe, summarized the Unix philosophy as follows:

Beyond these statements, he has also emphasized simplicity and minimalism in Unix programming:

Conversely, McIlroy has criticized modern Linux as having software bloat, remarking that, "adoring admirers have fed Linux goodies to a disheartening state of obesity."[5] He contrasts this with the earlier approach taken at Bell Labs when developing and revising Research Unix:[6]

Do One Thing and Do It Well

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 of Slackware Linux, invoked this design principle in a criticism of the systemd architecture, stating that, "attempting to control services, sockets, devices, mounts, etc., all within one daemon flies in the face of the Unix concept of doing one thing and doing it well."[7]

Eric Raymond's 17 Unix Rules

In his book The Art of Unix Programming that was first published in 2003,[8] Eric S. Raymond (open source advocate and programmer) summarizes the Unix philosophy as KISS Principle of "Keep it Simple, Stupid."[9] He provides a series of design rules:

Mike Gancarz: The UNIX Philosophy

In 1994, Mike Gancarz, a member of Digital Equipment Corporation's Unix Engineering Group (UEG), published The 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 the X Window System development team and author of Ultrix Window Manager (uwm).

The book focuses on porting UNIX to different computers during the Unix 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

  1. Small is beautiful.
  2. Make each program do one thing well.
  3. Build a prototype as soon as possible.
  4. Choose portability over efficiency.
  5. Store data in flat text files.
  6. Use software leverage to your advantage.
  7. Use shell scripts to increase leverage and portability.
  8. Avoid captive user interfaces.
  9. Make every program a filter.

"Worse is better"

See 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 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 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, 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.

Criticism

In a 1981 article entitled "The truth about Unix: The user interface is horrid"[10] published in Datamation, 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 of cognitive engineering,[11] he focused on how end-users comprehend and form a personal cognitive 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, Jonathan Blow criticised UNIX philosophy as being outdated.[12] He argued that tying together modular tools results in very inefficient programs. He says that UNIX philosophy suffers from similar problems to microservices: without overall supervision, big architectures end up ineffective and inefficient.

See also

References

External links

Notes and References

  1. Book: Raymond, Eric S. . The Art of Unix Programming . 2004 . Basics of the Unix Philosophy . http://www.catb.org/~esr/writings/taoup/html/ch01s06.html . 2003-09-23 . Addison-Wesley Professional . 0-13-142901-9 . Eric_S._Raymond . 2016-11-01.
  2. Unix Time-Sharing System: Foreword. . E. N. Pinson . B. A. Tague. Bell Laboratories. The Bell System Technical Journal. 8 July 1978. 1902–1903.
  3. Kernighan, Brian W. Pike, Rob. The UNIX Programming Environment. 1984. viii
  4. Program Design in the UNIX Environment . Rob Pike . Brian W. Kernighan . October 1984 . AT&T Bell Laboratories Technical Journal . 63 . 8 . part 2 . December 15, 2022.
  5. Web site: Remarks for Japan Prize award ceremony for Dennis Ritchie, May 19, 2011, Murray Hill, NJ. Douglas McIlroy. 2014-06-19.
  6. Web site: Ancestry of Linux — How the Fun Began (2005). Bill McGonigle. 2014-06-19.
  7. Web site: Interview with Patrick Volkerding of Slackware. linuxquestions.org . 2012-06-07. 2015-10-24.
  8. Book: Raymond , Eric . The Art of Unix Programming. Eric S. Raymond. 2003-09-19. 0-13-142901-9. Addison-Wesley. 2009-02-09.
  9. Book: Raymond , Eric . The Art of Unix Programming. Eric S. Raymond. 2003-09-19. 0-13-142901-9. Addison-Wesley. The Unix Philosophy in One Lesson. http://www.catb.org/~esr/writings/taoup/html/ch01s07.html. 2009-02-09.
  10. News: Norman . Don . The truth about Unix: The user interface is horrid . Datamation . 12 . 1981. 27 .
  11. Web site: An Oral History of Unix. Princeton University History of Science.
  12. News: On the Metal Podcast: Jonathan Blow .