Originally Published: Saturday, 22 April 2000 Author: Rob Bos
Published to: featured_articles/Featured Articles Page: 1/1 - [Printable]

The Miracle of Simplicity

Even the smallest and most simple programs are the most beautiful, and the most powerful. The tiny twenty-six kilobyte dd -- positively microscopic by modern standards -- is, for instance, one of the most elegant command line utilities in existence.

   Page 1 of 1  

As anyone who has been paying attention knows, Unix is comprised of many tiny little tools designed to interoperate together, creating, modifying, and otherwise interacting with "streams" of data, be they MP3 data, text files, or raw data. One of the core ideas of Unix is the idea of streams of data being modified by programs via "pipes" and "redirections" and small programs designed to filter and modify that data stream. It's a useful concept, which when combined with other ideas in Unix (the idea of devices as abstracted data streams or files, for instance), can do some very powerful things.

Even the smallest and most simple programs are the most beautiful, and the most powerful. The tiny twenty-six kilobyte dd -- positively microscopic by modern standards -- is, for instance, one of the most elegant command line utilities in existence. On the surface, it is deceptively simple; all it can do is create streams of data and put them somewhere else, or take input from one source and put it somewhere else; but in that tiny seed of a program lies huge possibilities.

With dd, you can create images of CDs and floppies for archival. With dd, you can send data across continents, or across a room. Combine dd with the "named pipe" and you have a whole new tool. The more I delve into Linux, the more uses I find for this deceptively simple command. One can create a disk image from scratch, wipe out an entire drive's data utterly irretrievably by redirecting data from /dev/zero, or back up that drive's data to a tape without messing about with tar.

Unix has, despite rhetoric and blustery arrogance, a beautiful, elegant simplicity at its heart in many ways. dd is just a small example of the ideas that have been expressed in various unices over the years. They work together, they each do their own very specific thing, and they are completely independent of any other programs.

Consider tail. This deceptively simple program has exactly one job in life: to output the trailing N lines of a file. Yet it has so many uses. tail can be used in conjunction with head to strip out a given line of a file (head --lines=10 | tail --lines=1), or to output lines as they are added to the file (tail -f), or in conjunction with grep as a cheap IRC log trigger - (tail -f irc.log | grep -q keyword && dosomething), or any of a hundred of other small uses. It's wonderful how such simple programs can be used in such powerful ways.

This is how integration should work. Lots of small independent utilities designed to do relatively small things, which can be combined in novel ways that the writers of those utilities never imagined. "Integration" isn't combining all the functions of software into one massive arcwelded chunk; integration is the ability to use disparate parts in a consistent way.

Simplicity, whether it's found in software, a clean mathematical theorem, or an elegantly designed building, is a solid foundation for further development. Complexity, bloated software, overcomplex theorems are chaotic attractors for future problems -- they may explain everything, they may do the job, but in the long run, they're simply not adequate as a foundation for future development. Bloatedness is a kludge to be avoided. Simplicity and parsimony must be the core of both a mathematical theorem and a piece of software.

This, if anything, is the lesson that the software industry must learn in order to maintain long-term success. The programs that survive are those that don't attempt to do everything, that interoperate seamlessly with other programs in the framework, that can do what their designers never really intended. Programs that do exactly one thing, programs that are simple and clean, will have few bugs and be simpler to use and maintain for both the beginner and advanced user.

Creating large, multifunctional arcwelded blocks that try to do everything by themselves simply creates a program that can't do anything particularly well. The pundits have it wrong; it's not convergence that is happening to the computer industry, it is divergence, as devices and programs become specialised to their various purposes and niches. Generalist machines have their places, but specialist machines and programs is where the market is heading.

Simplicity in design, clean interoperability, modularity, and consistent interface with other programs is a golden standard that Unix is constantly evolving toward. Some components have not changed significantly in thirty years, where others change on a weekly, even daily basis. The ones that eventually survive this constant shakedown will be the ones that fill all these criteria to the best of our technical and cultural abilities.

Rob Bos (rbos@linux.com) is installing 300 PCs this week. Six of them will be Linux. One step at a time.





   Page 1 of 1