# HG changeset patch # User meillo@marmaro.de # Date 1271057581 -7200 # Node ID ade392f024aa671eaab7013fe197c1809568a921 # Parent 46e34e43323185dad4c39734e71c6f6d21b6dc12 a lot of rework throughout the whole document diff -r 46e34e433231 -r ade392f024aa unix-phil.ms --- a/unix-phil.ms Sat Apr 10 15:00:38 2010 +0200 +++ b/unix-phil.ms Mon Apr 12 09:33:01 2010 +0200 @@ -22,6 +22,10 @@ .if '\\$1'1' .nr PS -2 .. +.am QP +.ps -1 +.. + .\"---------------------------------------- .TL @@ -65,7 +69,6 @@ unix philosophy .] .QP -.ps -1 The \fIUnix philosophy\fP is a set of cultural norms and philosophical approaches to developing software based on the experience of leading developers of the Unix operating system. @@ -98,23 +101,23 @@ but the fundamental idea behind it all, is ``small is beautiful''. .PP -The Unix Philosophy tells how to design and write good software for Unix. -Many concepts described here base on facilities of Unix. +The Unix Philosophy explains how to design good software for Unix. +Many concepts described here, base on facilities of Unix. Other operating systems may not offer such facilities, hence it may not be possible to design software in the way of the Unix Philosophy for them. .PP The Unix Philosophy has an idea of how the process of software development should look like, but large parts of the philosophy are quite independent -from the development process used. +from a concrete development process. However, one will soon recognize that some development processes work well with the ideas of the Unix Philosophy and support them, while others are at cross-purposes. -Kent Beck's books about Extreme Programming are valuable supplimental -resources. +Kent Beck's books about Extreme Programming are valuable supplemental +resources on this topic. .PP The question of how to actually write code and how the code should looks -like internally, are out of focus here. +like in detail, are out of focus here. ``The Practice of Programming'' by Kernighan and Pike, .[ kernighan pike @@ -135,15 +138,16 @@ It has nothing to do with visual appearance. If we take a program as a car, then its color is of no matter. Its design would be the car's size, its shape, the locations of doors, -the passenger/space ratio, the luggage capacity, and so forth. +the passenger/space ratio, the available controls and instruments, +and so forth. .PP Why should software get designed at all? It is general knowledge, that even a bad plan is better than no plan. Not designing software means programming without plan. This will pretty sure lead to horrible results. -Horrible to use and horrible to maintain. +Software that is horrible to use and horrible to maintain. These two aspects are the visible ones. -Often invisible are the wasted possible gains. +Often invisible though, are the wasted possible gains. Good software design can make these gains available. .PP A software's design deals with quality properties. @@ -166,30 +170,29 @@ It is the driving force behind all programming effort. Functional requirements are easier to define and to verify. .IP \(bu -Non-functional requirements are also called \fIquality\fP requirements. +Non-functional requirements are called \fIquality\fP requirements, too. The quality of a software are the properties that are not directly related to the software's basic functions. -Tools of bad quality often solve the problems they were written for, +Tools of bad quality often do solve the problems they were written for, but introduce problems and difficulties for usage and development, later on. Quality aspects are often overlooked at first sight, -and they are often difficult to define clearly and to verify. +and are often difficult to define clearly and to verify. .PP -Quality is of few matter when the software gets built initially, -but it is of matter for usage and maintenance of the software. -A short-sighted might see in developing a software mainly building something up. +Quality is hardly interesting when the software gets built initially, +but it has a high impact on usability and maintenance of the software, later. +A short-sighted might see in developing a software, mainly building something up. But experience shows, that building the software the first time is only a small amount of the overall work. -Bug fixing, extending, rebuilding of parts -\(en maintenance work, for short \(en +Bug fixing, extending, rebuilding of parts \(en maintenance work \(en does soon take over the major part of the time spent on a software. -Not to forget the usage of the software. +And of course, the time spent actually using the software. These processes are highly influenced by the software's quality. Thus, quality must not be neglected. -The problem with quality is that you hardly ``stumble over'' +However, the problem with quality is that you hardly ``stumble over'' bad quality during the first build, -but this is the time when you should care about good quality most. +although this is the time when you should care about good quality most. .PP -Software design is less the basic function of a software \(en +Software design has little to do with the basic function of a software \(en this requirement will get satisfied anyway. Software design is more about quality aspects of the software. Good design leads to good quality, bad design to bad quality. @@ -197,7 +200,7 @@ but good quality can provide a lot of additional gain, even at places where one never expected it. .PP -The ISO/IEC 9126-1 standard, part 1, +The ISO/IEC\|9126-1 standard, part\|1, .[ iso product quality .] @@ -222,7 +225,7 @@ (adaptability, installability, co-existence, replaceability) .LP Good design can improve these properties of a software, -bad designed software probably suffers from not having them. +bad designed software likely suffers in these points. .PP One further goal of software design is consistency. Consistency eases understanding, working on, and using things. @@ -230,7 +233,7 @@ can be provided by good design. .PP Software should be well designed because good design avoids many -problems during the software's lifetime. +problems during a software's lifetime. And software should be well designed because good design can offer much additional gain. Indeed, much effort should be spent into good design to make software more valuable. @@ -279,8 +282,8 @@ .DE Here, the list of files is filtered by .CW grep -to remove all that contain ``foo''. -The rest is the same as in the previous example. +to remove all lines that contain ``foo''. +The rest equals the previous example. .PP Finding the five largest entries in the current directory. .DS @@ -289,10 +292,10 @@ du -s * | sort -nr | sed 5q .DE .CW "du -s * -returns the recursively summed sizes of all files +returns the recursively summed sizes of all files in the current directory \(en no matter if they are regular files or directories. .CW "sort -nr -sorts the list numerically in reverse order. +sorts the list numerically in reverse order (descending). Finally, .CW "sed 5q quits after it has printed the fifth line. @@ -310,20 +313,20 @@ achievements of the Unix system. Pipes between programs have been possible in earlier operating systems, but it has never been a so central part of the concept. -When, in the early seventies, Doug McIlroy introduced pipes for the +When, in the early seventies, Doug McIlroy introduced pipes into the Unix system, ``it was this concept and notation for linking several programs together that transformed Unix from a basic file-sharing system to an entirely new way of computing.'' .[ aughenbaugh unix oral history -.] +.] .PP Being able to specify pipelines in an easy way is, however, not enough by itself. It is only one half. The other is the design of the programs that are used in the pipeline. -They have to interfaces that allows them to be used in such a way. +They need interfaces that allow them to be used in such a way. .NH 2 Interface design @@ -333,41 +336,41 @@ .LP Unix is, first of all, simple \(en Everything is a file. Files are sequences of bytes, without any special structure. -Programs should be filters, which read a stream of bytes from ``standard input'' (stdin) -and write a stream of bytes to ``standard output'' (stdout). -.PP +Programs should be filters, which read a stream of bytes from standard input (stdin) +and write a stream of bytes to standard output (stdout). If the files \fIare\fP sequences of bytes, and the programs \fIare\fP filters on byte streams, -then there is exactly one standardized data interface. -Thus it is possible to combine them in any desired way. +then there is exactly one data interface. +Hence it is possible to combine programs in any desired way. .PP -Even a handful of small programs will yield a large set of combinations, +Even a handful of small programs yields a large set of combinations, and thus a large set of different functions. This is leverage! If the programs are orthogonal to each other \(en the best case \(en then the set of different functions is greatest. .PP -Programs might also have a separate control interface, +Programs can also have a separate control interface, besides their data interface. The control interface is often called ``user interface'', because it is usually designed to be used by humans. The Unix Philosophy discourages to assume the user to be human. Interactive use of software is slow use of software, because the program waits for user input most of the time. -Interactive software requires the user to be in front of the computer -all the time. +Interactive software requires the user to be in front of the computer. Interactive software occupy the user's attention while they are running. .PP -Now we come back to the idea of using several small programs, combined, +Now to come back to the idea of combining several small programs, to have a more specific function. If these single tools would all be interactive, how would the user control them? -It is not only a problem to control several programs at once if they run at the same time, +It is not only a problem to control several programs at once, +if they run at the same time, it also very inefficient to have to control each of the single programs -that are intended to work as one large program. +that are intended to act as one large program. Hence, the Unix Philosophy discourages programs to demand interactive use. The behavior of programs should be defined at invocation. -This is done by specifying arguments (``command line switches'') to the program call. +This is done by specifying arguments to the program call +(command line switches). Gancarz discusses this topic as ``avoid captive user interfaces''. .[ gancarz unix philosophy @@ -402,10 +405,12 @@ than to write one large program with all the functionality included. If the small programs are combinable, then they offer even a larger set of functions than the single large program. -Hence, one gets two advantages out of writing small, combinable programs. +Hence, one gets two advantages out of writing small, combinable programs: +They are easier to write and they offer a greater set of functions through +combination. .PP -There are two drawbacks of the toolchest approach. -First, one simple, standardized, unidirectional interface has to be sufficient. +But there are also two main drawbacks of the toolchest approach. +First, one simple, standardized interface has to be sufficient. If one feels the need for more ``logic'' than a stream of bytes, then a different approach might be of need. But it is also possible, that he just can not imagine a design where @@ -415,27 +420,26 @@ a stream of bytes is a sufficient interface. .PP The second drawback of a toolchest affects the users. -A toolchest is often more difficult to use for novices. +A toolchest is often more difficult to use. It is necessary to become familiar with each of the tools, to be able to use the right one in a given situation. -Additionally, one needs to combine the tools in a senseful way on its own. -This is like a sharp knife \(en it is a powerful tool in the hand of a master, -but of no good value in the hand of an unskilled. +Additionally, one needs to combine the tools in a senseful way himself. +This is like a sharp knife \(en it is a powerful tool in the hand of a +master, but of no good value in the hand of an unskilled. +However, learning single, small tools of a toolchest is easier than +learning a complex tool. +And the user will already have a basic understanding of a yet unknown tool, +if the tools of a toolchest have a common, consistent style. +He will be able to transfer knowledge over from one tool to another. .PP -However, learning single, small tool of the toolchest is easier than -learning a complex tool. -The user will have a basic understanding of a yet unknown tool, -if the several tools of the toolchest have a common style. -He will be able to transfer knowledge over one tool to another. -.PP -Moreover, the second drawback can be removed easily by adding wrappers -around the single tools. -Novice users do not need to learn several tools if a professional wraps -the single commands into a more high-level script. +Moreover, the second drawback can be removed to a large extend +by adding wrappers around the basic tools. +Novice users do not need to learn several tools, if a professional wraps +complete command lines into a higher-level script. Note that the wrapper script still calls the small tools; -the wrapper script is just like a skin around. -No complexity is added this way, -but new programs can get created out of existing one with very low effort. +it is just like a skin around them. +No complexity is added this way. +But new programs can get created out of existing one with very low effort. .PP A wrapper script for finding the five largest entries in the current directory could look like this: @@ -445,10 +449,10 @@ #!/bin/sh du -s * | sort -nr | sed 5q .DE -The script itself is just a text file that calls the command line -a professional user would type in directly. -Making the program flexible on the number of entries it prints, -is easily possible: +The script itself is just a text file that calls the command line, +which a professional user would type in directly. +It is probably worth to make the program flexible on the number of +entries it prints: .DS .CW .ps -1 @@ -459,6 +463,9 @@ .DE This script acts like the one before, when called without an argument. But one can also specify a numerical argument to define the number of lines to print. +One can surely imagine even more flexible versions, however, +they will still relay on the external programs, +which do the actual work. .NH 2 A powerful shell @@ -466,23 +473,23 @@ \*(SN A powerful shell .XE .LP -It was already said, that the Unix shell provides the possibility to -combine small programs into large ones easily. -A powerful shell is a great feature in other ways, too. -.PP -For instance by including a scripting language. -The control statements are build into the shell. -The functions, however, are the normal programs, everyone can use on the system. -Thus, the programs are known, so learning to program in the shell is easy. +The Unix shell provides the possibility to combine small programs into large ones. +But a powerful shell is a great feature in other ways, too. +For instance by being scriptable. +Control statements are build into the shell. +The functions, however, are the normal programs of the system. +Thus, as the programs are already known, +learning to program in the shell becomes easy. Using normal programs as functions in the shell programming language is only possible because they are small and combinable tools in a toolchest style. .PP -The Unix shell encourages to write small scripts out of other programs, -because it is so easy to do. +The Unix shell encourages to write small scripts, +by combining existing programs, because it is so easy to do. This is a great step towards automation. It is wonderful if the effort to automate a task equals the effort -it takes to do it the second time by hand. -If it is so, then the user will be happy to automate everything he does more than once. +to do the task a second time by hand. +If this holds, +then the user will be happy to automate everything he does more than once. .PP Small programs that do one job well, standardized interfaces between them, a mechanism to combine parts to larger parts, and an easy way to automate tasks, @@ -492,33 +499,32 @@ The shell also encourages rapid prototyping. Many well known programs started as quickly hacked shell scripts, and turned into ``real'' programs, written in C, later. -Building a prototype first is a way to avoid the biggest problems +Building a prototype first, is a way to avoid the biggest problems in application development. -Fred Brooks writes in ``No Silver Bullet'': +Fred Brooks explains in ``No Silver Bullet'': .[ brooks no silver bullet .] .QP -.ps -1 The hardest single part of building a software system is deciding precisely what to build. No other part of the conceptual work is so difficult as establishing the detailed technical requirements, [...]. No other part of the work so cripples the resulting system if done wrong. No other part is more difficult to rectify later. .PP -Writing a prototype is a great method to become familiar with the requirements -and to actually run into real problems. -Today, prototyping is often seen as a first step in building a software. +Writing a prototype is a great method for becoming familiar with the requirements +and to run into real problems early. +.PP +Prototyping is often seen as a first step in building a software. This is, of course, good. However, the Unix Philosophy has an \fIadditional\fP perspective on prototyping: After having built the prototype, one might notice, that the prototype is already \fIgood enough\fP. -Hence, no reimplementation, in a more sophisticated programming language, might be of need, -for the moment. +Hence, no reimplementation, in a more sophisticated programming language, +might be of need, at least for the moment. Maybe later, it might be necessary to rewrite the software, but not now. -.PP -By delaying further work, one keeps the flexibility to react easily on +By delaying further work, one keeps the flexibility to react on changing requirements. Software parts that are not written will not miss the requirements. @@ -528,21 +534,25 @@ \*(SN Worse is better .XE .LP -The Unix Philosophy aims for the 80% solution; +The Unix Philosophy aims for the 90% solution; others call it the ``Worse is better'' approach. +Practical experience shows, that: .PP -First, practical experience shows, that it is almost never possible to define the +(1) It is almost never possible to define the requirements completely and correctly the first time. -Hence one should not try to; it will fail anyway. -Second, practical experience shows, that requirements change during time. +Hence one should not try to; one will fail anyway. +.PP +(2) Requirements change during time. Hence it is best to delay requirement-based design decisions as long as possible. -Also, the software should be small and flexible as long as possible +The software should be small and flexible as long as possible to react on changing requirements. Shell scripts, for example, are more easily adjusted as C programs. -Third, practical experience shows, that maintenance is hard work. -Hence, one should keep the amount of software as small as possible; +.PP +(3) Maintenance work is hard work. +Hence, one should keep the amount of code as small as possible; it should just fulfill the \fIcurrent\fP requirements. -Software parts that will be written later, do not need maintenance now. +Software parts that will be written in future, +do not need maintenance till then. .PP Starting with a prototype in a scripting language has several advantages: .IP \(bu @@ -550,16 +560,16 @@ .IP \(bu As working parts are available soon, the real requirements can get identified soon. .IP \(bu -When a software is usable, it gets used, and thus tested. +When a software is usable and valuable, it gets used, and thus tested. Hence problems will be found at early stages of the development. .IP \(bu The prototype might be enough for the moment, -thus further work on the software can be delayed to a time +thus further work on the software can get delayed to a time when one knows better about the requirements and problems, than now. .IP \(bu -Implementing now only the parts that are actually needed now, -requires fewer maintenance work. +Implementing now only the parts that are actually needed at the moment, +introduces fewer programming and maintenance work. .IP \(bu If the global situation changes so that the software is not needed anymore, then less effort was spent into the project, than it would have be @@ -575,13 +585,12 @@ Although these are just verbs, they do imply a specific view on the work process they describe. The better verb, however, is to \fIgrow\fP. -.PP Creating software in the sense of the Unix Philosophy is an incremental process. It starts with a first prototype, which evolves as requirements change. A quickly hacked shell script might become a large, sophisticated, compiled program this way. Its lifetime begins with the initial prototype and ends when the software is not used anymore. -While being alive it will get extended, rearranged, rebuilt (from scratch). +While being alive it will get extended, rearranged, rebuilt. Growing software matches the view that ``software is never finished. It is only released.'' .[ gancarz @@ -628,13 +637,13 @@ is best achieved by avoiding binary representations to store data, because binary representations differ from machine to machine. Textual representation is favored. -Historically, ASCII was the charset of choice. -In the future, UTF-8 might be the better choice, however. +Historically, \s-1ASCII\s0 was the charset of choice. +For the future, \s-1UTF\s0-8 might be the better choice. Important is that it is a plain text representation in a very common charset encoding. Apart from being able to transfer data between machines, -readable data has the great advantage, that humans are able -to directly edit it with text editors and other tools from the Unix toolchest. +readable data has the great advantage, that humans are able to directly +read and edit it with text editors and other tools from the Unix toolchest. .\" gancarz tenet 5 .PP (3) @@ -644,25 +653,23 @@ It is a special distinction if a software becomes used in fields of action, the original authors did never imagine. Software that solves problems in a general way will likely be used -for all kinds of similar problems. -Being too specific limits the range of uses. +for many kinds of similar problems. +Being too specific limits the range of usability. Requirements change through time, thus use cases change or even vanish. -A good example in this point is Allman's sendmail. +As a good example in this point, Allman identifies flexibility to be one major reason for sendmail's success: .[ allman sendmail .] .QP -.ps -1 Second, I limited myself to the routing function [...]. This was a departure from the dominant thought of the time, [...]. .QP -.ps -1 -Third, the sendmail configuration file was flexible enough to adopt +Third, the sendmail configuration file was flexible enough to adapt to a rapidly changing world [...]. .LP -Successful software adopts itself to the changing world. +Successful software adapts itself to the changing world. .PP (4) .I "Reuse of parts @@ -671,7 +678,7 @@ but parts of which the software is build may be general and independent enough to survive this death. If software is build by combining small independent programs, -then there are parts readily available for reuse. +then these parts are readily available for reuse. Who cares if the large program is a failure, but parts of it become successful instead? @@ -681,17 +688,17 @@ \*(SN Summary .XE .LP -This chapter explained the central ideas of the Unix Philosophy. -For each of the ideas, it was exposed what advantages they introduce. -The Unix Philosophy are guidelines that help to write valuable software. +This chapter explained central ideas of the Unix Philosophy. +For each of the ideas, the advantages they introduce were explained. +The Unix Philosophy are guidelines that help to write more valuable software. From the view point of a software developer or software designer, the Unix Philosophy provides answers to many software design problem. .PP The various ideas of the Unix Philosophy are very interweaved and can hardly be applied independently. However, the probably most important messages are: +.I "``Keep it simple!''" , .I "``Do one thing well!''" , -.I "``Keep it simple!''" , and .I "``Use software leverage!'' @@ -715,10 +722,10 @@ \s-1MH\s0 (``mail handler'') and its descendent \fInmh\fP (``new mail handler''). \s-1MUA\s0s provide functions to read, compose, and organize mail, -but (ideally) not to transfer. -In this document, the name \s-1MH\s0 will be used for both of them. +but (ideally) not to transfer it. +In this document, the name \s-1MH\s0 will be used to include nmh. A distinction will only be made if differences between -them are described. +\s-1MH\s0 and nmh are described. .NH 2 @@ -735,8 +742,8 @@ quarter century of unix %P 41 f. .] -It was a small program that either prints the user's mailbox file -or appends text to someone elses mailbox file, +It was a small program that either printed the user's mailbox file +or appended text to someone elses mailbox file, depending on the command line arguments. .[ manual mail(1) @@ -747,9 +754,9 @@ Later, emailing became more powerful, and thus more complex. The simple \f(CWmail\fP, which knew nothing of subjects, independent handling of single messages, -and long-time storage of them, was not powerful enough anymore. -At Berkeley, Kurt Shoens wrote \fIMail\fP (with capital `M') -in 1978 to provide additional functions for emailing. +and long-time email storage, was not powerful enough anymore. +In 1978 at Berkeley, Kurt Shoens wrote \fIMail\fP (with capital `M') +to provide additional functions for emailing. Mail was still one program, but now it was large and did several jobs. Its user interface is modeled after the one of \fIed\fP. @@ -768,7 +775,7 @@ called \s-1MS\s0 (for ``mail system''). But in 1977, Stockton Gaines and Norman Shapiro came up with a proposal of a new email system concept \(en -one that honors the Unix Philosophy. +one that honored the Unix Philosophy. The concept was implemented by Bruce Borden in 1978 and 1979. This was the birth of \s-1MH\s0 \(en the ``mail handler''. .PP @@ -777,7 +784,7 @@ However, it's core concepts remained the same. In the late 90s, when development of \s-1MH\s0 slowed down, Richard Coleman started with \fInmh\fP, the new mail handler. -His goal was to improve \s-1MH\s0, especially in regard of +His goal was to improve \s-1MH\s0 especially in regard of the requirements of modern emailing. Today, nmh is developed by various people on the Internet. .[ @@ -822,30 +829,30 @@ change current folder .IP \(bu .CW refile : -refile message into folder +refile message into different folder .IP \(bu .CW rmm : remove message .IP \(bu .CW comp : -compose a new message +compose new message .IP \(bu .CW repl : -reply to a message +reply to message .IP \(bu .CW forw : -forward a message +forward message .IP \(bu .CW send : -send a prepared message (this is how mail leaves the system) +send prepared message (this is how mail leaves the system) .LP \s-1MH\s0 has no special user interface like monolithic \s-1MUA\s0s have. The user does not leave the shell to run \s-1MH\s0, -but he uses the various \s-1MH\s0 programs within the shell. +instead he uses the various \s-1MH\s0 programs within the shell. Using a monolithic program with a captive user interface means ``entering'' the program, using it, and ``exiting'' the program. Using toolchests like \s-1MH\s0 means running programs, -alone or in combination with others, even from other toolchests, +alone or in combination with others, also from other toolchests, without leaving the shell. .NH 2 @@ -859,10 +866,11 @@ where mail folders are directories and mail messages are text files within them. Each mail folder contains a file \f(CW.mh_sequences\fP which lists -the public message sequences of that folder, for instance new messages. +the public message sequences of that folder, +for instance the \fIunseen\fP sequence for new messages. Mail messages are text files located in a mail folder. The files contain the messages as they were received. -They are numbered in ascending order in each folder. +They are named by ascending numbers in each folder. .PP This mailbox format is called ``\s-1MH\s0'' after the \s-1MUA\s0. Alternatives are \fImbox\fP and \fImaildir\fP. @@ -875,11 +883,10 @@ more difficult to write tools that work on mail messages, because it is always necessary to first find and extract the relevant message in the mbox file. -With the \s-1MH\s0 mailbox format, -each message is a self-standing item, by definition. +With the \s-1MH\s0 mailbox format, each message is a separate file. Also, the problem of concurrent access to one mailbox is reduced to the problem of concurrent access to one message. -Maildir is generally similar to \s-1MH\s0's format, +The maildir format is generally similar to the \s-1MH\s0 format, but modified towards guaranteed reliability. This involves some complexity, unfortunately. .PP @@ -891,9 +898,8 @@ \f(CWrefile\fP is like \f(CWmv\fP, and \f(CWrmm\fP is like \f(CWrm\fP. .PP -The context of tools in Unix consists mainly the current working directory, -the user identification, and the environment variables. -\s-1MH\s0 extends this context by two more items: +\s-1MH\s0 extends the context of processes in Unix by two more items, +for its tools: .IP \(bu The current mail folder, which is similar to the current working directory. For mail folders, \f(CWfolder\fP provides the corresponding functionality @@ -903,11 +909,13 @@ The current message, relative to a mail folder, is a special sequence. It enables commands like \f(CWnext\fP and \f(CWprev\fP. .LP -In contrast to Unix' context, which is chained to the shell session, -\s-1MH\s0's context is independent. -Usually there is one context for each user, but a user can have many -contexts. -Public sequences are an exception, as they belong to the mail folder. +In contrast to Unix' context, which is maintained by the kernel, +\s-1MH\s0's context must be maintained by the tools themselves. +Usually there is one context per user, which resides in his +\f(CWcontext\fP file in the \s-1MH\s0 directory, +but a user can have several contexts, too. +Public sequences are an exception, as they belong to a mail folder, +and reside in the \f(CW.mh_sequences\fP file there. .[ man page mh-profile mh-sequence .] @@ -918,23 +926,22 @@ \*(SN Discussion of the design .XE .LP -The following paragraphs discuss \s-1MH\s0 in regard to the tenets -of the Unix Philosophy which Gancarz identified. +This section discusses \s-1MH\s0 in regard to the tenets +of the Unix Philosophy that Gancarz identified. .PP .B "Small is beautiful and .B "do one thing well are two design goals that are directly visible in \s-1MH\s0. -Gancarz actually presents \s-1MH\s0 as example under the headline -``Making UNIX Do One Thing Well'': +Gancarz actually presents \s-1MH\s0 in his book as example under the +headline ``Making \s-1UNIX\s0 Do One Thing Well'': .[ gancarz unix philosophy %P 125 .] .QP -.ps -1 [\s-1MH\s0] consists of a series of programs which when combined give the user an enormous ability to manipulate electronic mail messages. @@ -942,8 +949,8 @@ possible to build large applications from smaller components, but also that such designs are actually preferable. .LP -The various small programs of \s-1MH\s0 were relatively easy -to write, because each of them is small, limited to one function, +The various programs of \s-1MH\s0 were relatively easy to write, +because each of them is small, limited to one function, and has clear boundaries. For the same reasons, they are also good to maintain. Further more, the system can easily get extended. @@ -952,19 +959,22 @@ (e.g. \f(CWmhbuild\fP). Also, different programs can exist to do the basically same job in different ways (e.g. in nmh: \f(CWshow\fP and \f(CWmhshow\fP). +.PP If someone needs a mail system with some additionally -functions that are available nowhere yet, he best takes a -toolchest system like \s-1MH\s0 where he can add the -functionality with little work. +functions that are not available anywhere yet, he best expands a +toolchest system like \s-1MH\s0. +There he can add new functionality by simply adding additional +programs to the toolchest. +There he does not risk to break existing functionality by doing so. .PP .B "Store data in flat text files is followed by \s-1MH\s0. This is not surprising, because email messages are already plain text. \s-1MH\s0 stores the messages as it receives them, -thus any other tool that works on RFC 2822 mail messages can operate +thus any other tool that works on \s-1RFC\s0\|2822 mail messages can operate on the messages in an \s-1MH\s0 mailbox. -All other files \s-1MH\s0 uses are plain text too. +All other files \s-1MH\s0 uses are plain text, too. It is therefore possible and encouraged to use the text processing tools of Unix' toolchest to extend \s-1MH\s0's toolchest. @@ -973,11 +983,12 @@ \s-1MH\s0 is perfectly suited for non-interactive use. It offers all functions directly and without captive user interfaces. If, nonetheless, users want a graphical user interface, -they can have it with \fIxmh\fP or \fIexmh\fP, too. +they can have it with \fIxmh\fP or \fIexmh\fP. These are graphical frontends for the \s-1MH\s0 toolchest. This means, all email-related work is still done by \s-1MH\s0 tools, -but the frontend issues the appropriate calls when the user +but the frontend calls the appropriate commands when the user clicks on buttons. +.PP Providing easy-to-use user interfaces in form of frontends is a good approach, because it does not limit the power of the backend itself. The frontend will anyway only be able to make a subset of the @@ -985,8 +996,8 @@ But if it is a separate program, then the missing parts can still be accessed at the backend directly. If it is integrated, then this will hardly be possible. -Further more, it is possible to have different frontends to the same -backend. +An additional advantage is the possibility to have different frontends +to the same backend. .PP .B "Choose portability over efficiency @@ -998,9 +1009,9 @@ bolsky korn korn shell .] -They demonstrated, in chapter 18 of the book, a basic implementation +Chapter\|18 of the book shows a basic implementation of a subset of \s-1MH\s0 in ksh scripts. -Of course, this was just a demonstration, but a brilliant one. +Of course, this is just a demonstration, but a brilliant one. It shows how quickly one can implement such a prototype with shell scripts, and how readable they are. The implementation in the scripting language may not be very fast, @@ -1008,20 +1019,21 @@ By having the code in an interpreted language, like the shell, portability becomes a minor issue, if we assume the interpreter to be widespread. +.PP This demonstration also shows how easy it is to create single programs of a toolchest software. -There are eight tools (two of them have multiple names) and 16 functions -with supporting code. -Each tool comprises between 12 and 38 lines of ksh, +Eight tools (two of them have multiple names) and 16 functions +with supporting code are presented to the reader. +The tools comprise less than 40 lines of ksh each, in total about 200 lines. -The functions comprise between 3 and 78 lines of ksh, +The functions comprise less than 80 lines of ksh each, in total about 450 lines. Such small software is easy to write, easy to understand, and thus easy to maintain. A toolchest improves the possibility to only write some parts and though create a working result. -Expanding the toolchest without global changes will likely be -possible, too. +Expanding the toolchest, even without global changes, +will likely be possible. .PP .B "Use software leverage to your advantage @@ -1031,12 +1043,13 @@ Tailoring the environment is heavily encouraged by the ability to directly define default options to programs. It is even possible to define different default options -depending on the name under which the program was called. -Software leverage is heavily encouraged by the ease it is to -create shell scripts that run a specific command line, +depending on the name under which a program is called. +Software leverage is heavily encouraged by the ease of +creating shell scripts that run a specific command line, built of several \s-1MH\s0 programs. There is few software that so much wants users to tailor their environment and to leverage the use of the software, like \s-1MH\s0. +.PP Just to make one example: One might prefer a different listing format for the \f(CWscan\fP program. @@ -1053,25 +1066,22 @@ instead of changing the default, he needs to create a link to \f(CWscan\fP, for instance titled \f(CWscan2\fP. The line in \f(CW.mh_profile\fP would then start with \f(CWscan2\fP, -as the option should only be in effect when scan is called as +as the option should only be in effect for a program that is called as \f(CWscan2\fP. .PP .B "Make every program a filter is hard to find in \s-1MH\s0. The reason therefore is that most of \s-1MH\s0's tools provide -basic file system operations for the mailboxes. -The reason is the same because of which -\f(CWls\fP, \f(CWcp\fP, \f(CWmv\fP, and \f(CWrm\fP -aren't filters neither. -However, they build a basis on which filters can operate. +basic file system operations for mailboxes. +It is the same reason because of which \f(CWls\fP, \f(CWcp\fP, \f(CWmv\fP, +and \f(CWrm\fP aren't filters neither. \s-1MH\s0 does not provide many filters itself, but it is a basis to write filters for. -An example would be a mail message text highlighter, +An example would be a mail text highlighter, that means a program that makes use of a color terminal to display header lines, quotations, and signatures in distinct colors. -The author's version of this program, for instance, -is a 25 line awk script. +The author's version of such a program is an awk script with 25 lines. .PP .B "Build a prototype as soon as possible @@ -1087,8 +1097,7 @@ %P 132 .] .QP -.ps -1 -[...] but they [Stockton Gaines and Norm Shapiro] were not able +[...] but [Stockton Gaines and Norm Shapiro] were not able to convince anyone that such a system would be fast enough to be usable. I proposed a very short project to prove the basic concepts, and my management agreed. @@ -1107,33 +1116,33 @@ \*(SN Problems .XE .LP -\s-1MH\s0, for sure is not without problems. +\s-1MH\s0 is not without problems. There are two main problems: one is technical, the other is about human behavior. .PP \s-1MH\s0 is old and email today is very different to email in the time when \s-1MH\s0 was designed. -\s-1MH\s0 adopted to the changes pretty well, but it is limited. -For example in development resources. +\s-1MH\s0 adapted to the changes pretty well, but it is limited, though. \s-1MIME\s0 support and support for different character encodings is available, but only on a moderate level. -More active developers could quickly improve there. -It is also limited by design, which is the larger problem. +This comes from limited development resources. +More active developers could quickly change this. +But \s-1MH\s0 is also limited by design, which is the larger problem. \s-1IMAP\s0, for example, conflicts with \s-1MH\s0's design to a large extend. These design conflicts are not easily solvable. Possibly, they require a redesign. -Maybe \s-1IMAP\s0 is too different to the classic mail model which \s-1MH\s0 covers, -hence \s-1MH\s0 may never work well with \s-1IMAP\s0. +\s-1IMAP\s0 may be too different to the classic mail model, +which \s-1MH\s0 covers, so that \s-1MH\s0 may never support it well. .PP -The other kind of problem is human habits. -When in this world almost all \s-1MUA\s0s are monolithic, +The other kind of problem are human habits. +In this world, where almost all \s-1MUA\s0s are monolithic, it is very difficult to convince people to use a toolbox style \s-1MUA\s0 like \s-1MH\s0. -The habits are so strong, that even people who understood the concept +The habits are so strong, that even people who understand the concept and advantages of \s-1MH\s0 do not like to switch, simply because \s-1MH\s0 is different. Unfortunately, the frontends to \s-1MH\s0, which could provide familiar look'n'feel, -are quite outdated and thus not very appealing compared to the modern interfaces -which monolithic \s-1MUA\s0s offer. +are quite outdated and thus not very appealing, compared to the modern interfaces +of many monolithic \s-1MUA\s0s. .NH 2 Summary \s-1MH\s0 @@ -1141,17 +1150,12 @@ \*(SN Summary \s-1MH\s0 .XE .LP -\s-1MH\s0 is an \s-1MUA\s0 that follows the Unix Philosophy in its design -and implementation. +\s-1MH\s0 is an \s-1MUA\s0 that follows the Unix Philosophy in its design. It consists of a toolchest of small tools, each of them does one job well. -The tools are orthogonal to each other, to a large extend. -However, for historical reasons, there also exist distinct tools -that cover the same task. -.PP The toolchest approach offers great flexibility to the user. -He can use the complete power of the Unix shell with \s-1MH\s0. +It is possible to utilize the complete power of the Unix shell with \s-1MH\s0. This makes \s-1MH\s0 a very powerful mail system. -Extending and customizing \s-1MH\s0 is easy and encouraged, too. +Extending and customizing \s-1MH\s0 is easy and encouraged. .PP Apart from the user's perspective, \s-1MH\s0 is development-friendly. Its overall design follows clear rules. @@ -1175,9 +1179,11 @@ .XE .LP The last chapter took a look on the \s-1MUA\s0 \s-1MH\s0, -this chapter is about uzbl, a web browser that adheres to the Unix Philosophy. -``uzbl'' is the \fIlolcat\fP's word for the English adjective ``usable''. -It is pronounced the identical. +which is an old and established software. +This chapter covers uzbl, a fresh new project. +Uzbl is a web browser that adheres to the Unix Philosophy. +Its name comes from the \fILolspeak\fP word for ``usable''; +it is pronounced identical. .NH 2 Historical background @@ -1203,10 +1209,10 @@ One week later, uzbl had an own website. One month after the first code showed up, a mailing list was installed to coordinate and discuss further development. -A wiki was set up to store documentation and scripts that showed up on the +Then a wiki followed to store documentation and scripts that showed up on the mailing list and elsewhere. .PP -In the, now, one year of uzbl's existence, it was heavily developed in various branches. +In the, now, one year of uzbl's existence, it was heavily developed on various branches. Plaetinck's task became more and more to only merge the best code from the different branches into his main branch, and to apply patches. About once a month, Plaetinck released a new version. @@ -1228,7 +1234,7 @@ Today, uzbl is divided into uzbl-core and uzbl-browser. Uzbl-core is, how its name already indicates, the core of uzbl. It handles commands and events to interface other programs, -and also displays webpages by using webkit as render engine. +and also displays webpages by using \fIwebkit\fP as render engine. Uzbl-browser combines uzbl-core with a bunch of handler scripts, a status bar, an event manager, yanking, pasting, page searching, zooming, and more stuff, to form a ``complete'' web browser. @@ -1236,19 +1242,20 @@ so uzbl-core is included. .PP Unlike most other web browsers, uzbl is mainly the mediator between the -various tools that cover single jobs of web browsing. +various tools that cover single jobs. Therefore, uzbl listens for commands on a named pipe (fifo), a Unix socket, and on stdin, and it writes events to a Unix socket and to stdout. -The graphical rendering of the webpage is done by webkit, a web content engine. -Uzbl-core is build around this library. Loading a webpage in a running uzbl instance requires only: .DS .CW echo 'uri http://example.org' >/path/to/uzbl-fifo .DE +The graphical rendering of the webpage is done by webkit, +a web content engine. +Uzbl-core is built around libwebkit. .PP -Downloads, browsing history, bookmarks, and thelike are not provided -by uzbl-core itself, as they are in other web browsers. +Downloads, browsing history, bookmarks, and the like are not provided +by the core itself, like they are in other web browsers. Uzbl-browser also only provides, so called, handler scripts that wrap external applications which provide the actual functionality. For instance, \fIwget\fP is used to download files and uzbl-browser @@ -1258,7 +1265,7 @@ Modern web browsers are proud to have addons, plugins, and modules, instead. This is their effort to achieve similar goals. But instead of using existing, external programs, modern web browsers -include these functions, although they might be loaded at runtime. +include these functions. .NH 2 Discussion of the design @@ -1275,13 +1282,13 @@ The common definition of a web browser is, of course, highly influenced by existing implementations of web browsers, although they are degenerated. Web browsers should be programs to browse the web, and nothing more. -This is the one thing they should do, as demanded by the Unix Philosophy. +This is the one thing they should do. .PP -Web browsers should, for instance, not manage downloads. +Web browsers should not, for instance, manage downloads. This is the job download managers exist for. Download managers do primary care about being good in downloading files. Modern web browsers provide download management only as a secondary feature. -How could they perform this job better, than programs that exist only for +How could they do this job better, than programs that exist only for this very job? And how could anyone want less than the best download manager available? .PP @@ -1306,42 +1313,39 @@ matches good here. There was the question, how anyone could want anything less than the best program for the job. -But as personal preferences matter much, -it is probably more important to ask: +But as personal preferences matter, it is probably more important to ask: How could anyone want something else than his preferred program for the job? .PP -Usually users want one program for one job. +Usually users want one program for a specific job. Hence, whenever the task is, for instance, downloading, -exactly one download manager should be used. +the same download manager should be used. More advanced users might want to have this download manager in this situation and that one in that situation. They should be able to configure it this way. With uzbl, one can use any download manager the user wants. To switch to a different one, only one line in a small handler script needs to be changed. -Alternatively it would be possible to query an entry in a global file -or an environment variable, which specifies the download manager to use, -in the handler script. +Alternatively it would be possible to query the program to use by +reading a global file or an environment variable, in the handler script. .PP -As uzbl does neither have its own download manager nor depends on a -specific one, thus uzbl's browsing abilities will not be lowered by having +Uzbl does neither have its own download manager nor depends on a +specific one, hence uzbl's browsing abilities will not be lowered by having a bad download manager. -Uzbl's download capabilities will just as good as the ones of the best +Uzbl's download capabilities will be just as good as the ones of the best download manager available on the system. Of course, this applies to all of the other supplementary tools, too. .PP .B "Use software leverage to your advantage" . -Shell scripts are a good choice to extend uzbl. Uzbl is designed to be extended by external tools. These external tools are usually wrapped by small handler shell scripts. Shell scripts are the glue in this approach. They make the various parts fit together. .PP -As an example, the history mechanism of uzbl shall be presented. +The history mechanism of uzbl shall be presented as an example. Uzbl is configured to spawn a script to append an entry to the history whenever the event of a fully loaded page occurs. -The script to append the entry to the history not much more than: +The script to append the entry to the history is not much more than: .DS .CW #!/bin/sh @@ -1349,11 +1353,13 @@ echo `date +'%Y-%m-%d %H:%M:%S'`" $6 $7" >> $file .DE \f(CW$6\fP and \f(CW$7\fP expand to the \s-1URL\s0 and the page title. -For loading an entry, a key is bound to spawn a load from history script. +.PP +For loading an entry, a key is bound to spawn a load-from-history script. The script reverses the history to have newer entries first, -then displays \fIdmenu\fP to select an item, +then displays \fIdmenu\fP to let the user select an item, and afterwards writes the selected \s-1URL\s0 into uzbl's command input pipe. -With error checking and corner cases removed, the script looks like this: +With error checking and corner case handling removed, +the script looks like this: .DS .CW #!/bin/sh @@ -1369,10 +1375,11 @@ One could say, that uzbl, to a large extend, actually \fIis\fP a captive user interface. But the difference to most other web browsers is, that uzbl is only -the captive user interface frontend and the core of the backend. +the captive user interface frontend (and the core of the backend). Many parts of the backend are independent of uzbl. -Some are distributed with uzbl, for some external programs, handler scripts -are distributed, arbitrary additional functionality can be added if desired. +Some are distributed with uzbl, for some external programs, +handler scripts are distributed, +but arbitrary additional functionality can be added if desired. .PP The frontend is captive \(en that is true. This is okay for the task of browsing the web, as this task is only relevant @@ -1387,20 +1394,20 @@ .B "Make every program a filter" . Graphical web browsers are almost dead ends in the chain of information flow. Thus it is difficult to see what graphical web browsers should filter. -Graphical web browsers exist almost only for interactive use by humans. +Graphical web browsers exist almost only to be interactively used by humans. The only case when one might want to automate the rendering function is to generate images of rendered webpages. .PP .B "Small is beautiful" -is not easy to apply to a web browser, primary because modern web technology -is very complex; hence the rendering task is very complex. -Modern web browsers will always consist of many thousand lines of code, +is not easy to apply to a web browser, because modern web technology +is very complex, hence the rendering task is very complex. +Modern web browsers have to consist of many thousand lines of code, unfortunately. Using the toolchest approach and wrappers can split the browser into several small parts, tough. .PP -Uzbl-core consists of about 3\,500 lines of C code. +As of March 2010, uzbl-core consists of about 3\,500 lines of C code. The distribution includes another 3\,500 lines of Shell and Python code, which are the handler scripts and plugins like a modal interface. Further more, uzbl uses functionality of external tools like @@ -1410,7 +1417,6 @@ Webkit consists of roughly 400\,000 (!) lines of code. Unfortunately, small web render engines are not possible anymore because of the modern web. -The problems section will explain this in more detail. .PP .B "Build a prototype as soon as possible" . @@ -1421,7 +1427,8 @@ Within the first year of uzbl's existence, a new version was released more often than once a month. Different forks and branches arose. -They introduced new features, which were tested for suitability. +They introduced new features, which were tested for suitability +for the main branch. The experiences of using prototypes influenced further development. Actually, all development was community driven. Plaetinck says, three months after uzbl's birth: @@ -1447,7 +1454,7 @@ But uzbl has to provide this similar look and feel to be accepted as a ``normal'' browser by ``normal'' users. .PP -The more important problem is the modern web. +Though, the more important problem is the modern web. The modern web is simply broken. It has state in a state-less protocol, it misuses technologies, @@ -1455,7 +1462,7 @@ The result are web content render engines that must consist of hundreds of thousands lines of code. They also must combine and integrate many different technologies, -only to make our modern web usable. +only to make our modern web accessible. Website to image converter are hardly possible to run without human interaction because of state in sessions, impossible deep-linking, and unautomatable technologies. @@ -1474,12 +1481,11 @@ that is how uzbl is seen by its authors. Indeed, uzbl follows the Unix Philosophy in many ways. It consists of independent parts that work together, -its core is mainly a mediator which glues the parts together. +while its core is mainly a mediator which glues the parts together. .PP Software leverage can excellently be seen in uzbl. -It makes use of external tools, separates independent tasks -in independent parts, and glues them together with small -handler scripts, around uzbl-core. +External tools are used, independent tasks are separated +in independent parts and glued together with small handler scripts. .PP As uzbl, more or less, consists of a set of tools and a bit of glue, anyone can put the parts together and expand it @@ -1488,7 +1494,7 @@ These properties make it valuable for advanced users, but may keep novice users from using it. .PP -Uzbl's main problem is the modern web, that makes it hard +But uzbl's main problem is the modern web, that makes it hard to design a sane web browser. Despite this bad situation, uzbl does a fairly good job.