The Unix philosophy in a nutshell

1.4 The Unix philosophy in a nutshell

The tenets of the Unix philosophy are deceptively simple. They are so simple, in fact, that people tend to regard them as having little importance. That's where the deception comes in. Their simplicity disguises the fact that these ideas are incredibly effective when carried out consistently.

The following list will give you an idea of what the Unix philosophy tenets are. The rest of the book will help you to understand why they are important.

  1. Small is beautiful. Small things have tremendous advantages over their larger counterparts. Among these is the ability to combine with other small things in unique and useful ways, ways often unforeseen by the original designer.

  2. Make each program do one thing well. By focusing on a single task, a program can eliminate much extraneous code that often results in excess overhead, unnecessary complexity, and a lack of flexibility.

  3. Build a prototype as soon as possible. Most people would agree that prototyping is a valuable element of any project. But whereas prototyping is only a small part of the design phase under other methodologies, under Unix it is the principal vehicle for generating an effective design.

  4. Choose portability over efficiency. When Unix broke new ground as the first portable operating system of any significance, it was big news. Today portability is taken for granted as a necessity in any modern software design, an example of a tenet that has gained wide acceptance on other systems besides Unix.

  5. Store data in flat text files. The choice between portability and efficiency addresses the value of portable code. Portable data is at least as important as-if not more important than-portable code. Portable data is the often-neglected part of the portability formula.

  6. Use software leverage to your advantage. Many programmers have only a superficial understanding of the importance of reusable code modules. Code reuse helps one take advantage of software leverage, a powerful concept that some Unix developers use to create numerous applications in a comparatively short time.

  7. Use shell scripts to increase leverage and portability. Shell scripts are double-edged swords for enhancing both software leverage and portability in a design. Whenever possible, writing a script instead of a complete C program is the way to go.

  8. Avoid captive user interfaces. Some commands have user interfaces known to Unix developers as "captive" user interfaces. These prevent the user from running other commands while the command is in use, effectively making the user a captive to the system for the duration of the command. In a graphical user interface world, such interfaces would be called "modal."

  9. Make every program a filter. The fundamental nature of all software programs is that they only modify data; they do not create it. Therefore, they should be written to perform as filters since they are filters.

The preceding list contains tenets about which Unix developers are dogmatic. You will find similar lists in other books on Unix, as they are the points that everyone considers to be foundational Unix concepts. If you adopt them, you will be considered to be a "Unix person."

The following lists 10 lesser tenets, ideas that tend to be part of the Unix world's belief system.[2] Not everyone involved with Unix is dogmatic about these, and some of them aren't strictly characteristic of Unix. Still, they seem to be a part of the Unix culture (and the Linux culture by inclusion).

  1. Allow the user to tailor the environment. Unix users like the ability to control their environment-all of it. Many Unix applications decidedly refrain from making decisions about styles of interaction and instead leave the choices to the user. The idea here is to implement mechanisms for doing things, not policies for how to do them. Let users discover their own paths to computer nirvana.

  2. Make operating system kernels small and lightweight. Despite the never-ending push for new features, Unix developers prefer to keep the most central part of an operating system small. They don't always succeed at this, but this is their goal.

  3. Use lowercase and keep it short. Using lowercase characters is a tradition in the Unix environment that has persisted long after the reason for doing so disappeared. Many Unix users today use lowercase commands and cryptic names because they want to, not because they're forced to anymore.

  4. Save trees. Unix users generally frown on using paper listings. There are good reasons for keeping all text online and using powerful tools to manipulate it.

  5. Silence is golden. Unix commands are notoriously silent when it comes to producing detailed error messages. Although more experienced Unix users consider this a desirable trait, many users of other operating systems would beg to differ.

  6. Think parallel. Most tasks can be broken down into a series of smaller subtasks. These subtasks can then be run in parallel to accomplish more in the same amount of time as one large task. A significant amount of activity occurs around symmetric multiprocessing (SMP) designs today, an example of a general trend in the computer industry towards parallelization.

  7. The sum of the parts is greater than the whole. This tenet stems from the idea that a large application built from a collection of smaller programs is more flexible, and hence, more useful than a single large program. The same functional capability may exist in both solutions, but the collection-of-small-programs approach is the more forward-looking of the two.

  8. Look for the 90-percent solution. Doing 100 percent of anything is difficult. Doing 90 percent is far more efficient and cost effective. Unix developers often look for solutions that satisfy 90 percent of the target user base, leaving the other 10 percent to fend for itself.

  9. Worse is better. Unix aficionados believe that a "least common denominator" system is the one most likely to survive. That which is cheap, but effective, is far more likely to proliferate than that which is high quality and expensive. The PC-compatible world borrowed this idea from the Unix world and is making quite a go of it. The keyword here is inclusion. If something is accessible enough that it can include virtually anyone, it is better than something that presents itself as being "exclusive."

  10. Think hierarchically. Unix users and developers prefer to organize things hierarchically. For example, the Unix directory structure was among the first tree-structured architectures applied to file systems. Unix has extended hierarchical thinking to other areas, such as network service naming, window management, and object-oriented development.

After reading the list of tenets, you may be wondering just what all the fuss is about. "Small is beautiful" is not such a big deal. "Doing one thing well" sounds pretty narrow-minded in and of itself. Choosing portability over efficiency isn't the sort of idea that will change the world.

Is that all there is to Unix? Is Linux just a small operating system for small minds?

Perhaps we should mention that Volkswagen built a marketing campaign around the "small is beautiful" concept that helped it sell millions of automobiles. Or consider that Sun Microsystems, a leading Unix systems vendor, based its strategy on putting "all the wood behind one arrowhead" or, in other words, "doing one thing well." Could all the interest in PDAs, wireless Web access, and hand-held video have something to do with portability?

Come. Let us begin the journey.

[2]Given words such as "dogmatic," "tenets," and "belief system," might one wonder whether the Unix philosophy describes a cultural phenomenon in addition to a technological one.



Linux and the Unix Philosophy
Linux and the Unix Philosophy
ISBN: 1555582737
EAN: 2147483647
Year: 2005
Pages: 92
Authors: Mike Gancarz

Similar book on Amazon

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net