Please use the alphabetical Index,
Contents List,
and your browsers search feature to find what you need.
This page generated at Wed Aug 19 09:17:19 PDT 1998.
Contents
The UNIX Philosophy
Gancarz 95,Mike Gancarz, The UNIX Philosophy, Digital Press, Newton, MA 1995, 151 pp., $19.95, ISBN 1-55558-123-4
Mike Gancarz summarizes his philosophy as a series of rules or tenets.
Here is a quick list with some notes.
Nine Main Tenets
- (1): Small is beautiful.
A Small thing is easier to produce and use. It can
be combined with other small things in many ways to
do special things.
- (2): Make each program do one thing well.
For example an editor should not contain code to handle
wild cards in file names. A shell should not contain
an editor. Avoid featuritis and code bloat.
- (3): Build a prototype as soon as possible.
Within UNIX most work is done by starting with a simple
semi-functional, special case program that can be used to
find out what works. This is generalized until it does slightly
more than you want it to do.
- (4): Choose portability over efficiency.
You can always port a portable solution to a faster CPU!
Besides, you will get more value for your work if the code
is still in use on all future systems that you use, than if it
is super-fast and only works on the system you have today.
- (5): Store numerical data in flat ASCII files.
ASCII data is portable, EMailable, editable, processable, etc.
Flat files don't have a complex structure that needs lots
of parsing. Examples: /etc/passwd, /etc/group, the output
of 'last', the output of 'ls -lrt', and so on.
A flat file is a file where each line can be treated in much
the same way as the others. For example, a C program has a
structure but a list of function calls with names and line numbers
is flat.
- (6): Use software leverage to your advantage.
By using a UNIX program you can make one line of code
call up 5000 lines of debugged code.
- (7): Use Shell scripts to increase leverage and portability.
A shell script combines small ready-made components in new ways.
Combining 'ps', 'grep', 'awk', and 'sh' into a script to kill
zombies on 'delphi' effectively reused at least 10K Lines Of Code
from these programs. A shell script can be interpreted by the
same shell on a different system - even one that does not run UNIX!
- (8): Avoid Captive User Interfaces.
The user should not be held hostage by a program and not
given access to all the other tools that lie around. Further
the user shouldn't be offered a choice from a small set of options
when they may want to do anything. The user has a right to
do what they want, not what the programmer chooses to put in a
set of menus or prompts!
Corollary: If the user is a captive, give the user a chance to escape.
Example: vi has ':!ksh', and 'lynx' has '!', and mailx has '!' and
'~!'.
- (9): Make every program a filter.
A filter is a program that reads an ASCII file
and produces an ASCII file having done something to it.
Filters can be connected to the user, to files, and to each other.
Ten Lesser Tenets
- (10): Allow the User to Tailor the Environment.
- (11): Make OS Kernels Small and Lightweight
- (12): Use lower-case and keep it short
An engrained tradition. BUT CAPITAL ARE HARDER TO
READ THAN LOWERCASE anyway.
- (13): Save Trees
Avoid printing data out. Printed data is dead data!
Instead use tools and browsers and filters to explore
the data online.
- (14): Silence is Golden
Do nothing gracefully. Do not output "list empty" as an
alternative to a list of elements. If you do, it becomes
difficult for a filter to distinguish a one line list from
an empty list symbolysed by a list. If used interactively
perhaps output a short header on all lists.
- (15): Think Parallel
Look for ways to break down tasks that can run in parallel
and pass data from one to another. Look for Pipes. Also look
for client server solutions with a lockable data base connecting
them - 'mail' for example.
- (16): The Sum of the parts is greater than the whole.
If you have 4 filters: a,b,c,d. Then you have the following
combinations: a|a, a|b, a|c, a|d, b|a, b|b, ..., d|d. From
4 pieces: 16 combinations in pairs. Then you have the 64
combinations of three of them and so on.
- (17): Look for the 90% Solution
A script that does 90% of the job and lets your
intelligence do the last 10% today is often better than
a 100% solution next year.
- (18): Worse is Better
It is better to be cheap and effective than expensive and high
quality. Think: ball point pens, disposable lighters, PC clones,
and MicroSoft Software.
- (19): Think Hierarchically
An Implicit Assumption
Mike does not mention the following, but assumes it through-out:
- (20): Connect the programmer to the problem and leave him/her alone.
. . . . . . . . . ( end of section The UNIX Philosophy) <<Contents | Index>>
Labels and Definitions in Alphabetical Order
- 1 (Axiom or label)
- 10 (Axiom or label)
- 11 (Axiom or label)
- 12 (Axiom or label)
- 13 (Axiom or label)
- 14 (Axiom or label)
- 15 (Axiom or label)
- 16 (Axiom or label)
- 17 (Axiom or label)
- 18 (Axiom or label)
- 19 (Axiom or label)
- 2 (Axiom or label)
- 20 (Axiom or label)
- 3 (Axiom or label)
- 4 (Axiom or label)
- 5 (Axiom or label)
- 6 (Axiom or label)
- 7 (Axiom or label)
- 8 (Axiom or label)
- 9 (Axiom or label)