|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620 |
- title: The Tao Of Programming
- url: http://canonical.org/~kragen/tao-of-programming.html
- hash_url: 25446bf1138b602543230e36ad47fbc8
-
- <p> Translated by Geoffrey James
-
- </p><p> Transcribed by Duke Hillard
-
- </p><p> Transmitted by Anupam Trivedi, Sajitha Tampi, and Meghshyam Jagannath
-
- </p><p> Re-html-ized and edited by Kragen Sittler
-
- </p><p> <em>Last modified 1996-04-10 or earlier</em>
-
- </p><hr/>
-
- <h2 align="right"> Table of Contents </h2>
-
- <ol>
- <li> <a href="#book1">The Silent Void</a>
- </li><li> <a href="#book2">The Ancient Masters</a>
- </li><li> <a href="#book3">Design</a>
- </li><li> <a href="#book4">Coding</a>
- </li><li> <a href="#book5">Maintenance</a>
- </li><li> <a href="#book6">Management</a>
- </li><li> <a href="#book7">Corporate Wisdom</a>
- </li><li> <a href="#book8">Hardware and Software</a>
- </li><li> <a href="#book9">Epilogue</a>
- </li></ol>
-
- <hr/>
-
-
-
- <p> Thus spake the master programmer:
-
- </p><p> ``When you have learned to snatch the error code from the trap frame, it
- will be time for you to leave.''
-
- </p><h3 align="center"> 1.1</h3>
-
- <p> Something mysterious is formed, born in the silent void. Waiting alone
- and unmoving, it is at once still and yet in constant motion. It is
- the source of all programs. I do not know its name, so I will call it
- the Tao of Programming.
-
- </p><p> If the Tao is great, then the operating system is great. If the
- operating system is great, then the compiler is great. If the compiler
- is great, then the application is great. The user is pleased and there
- exists harmony in the world.
-
- </p><p> The Tao of Programming flows far away and returns on the wind of morning.
-
- </p><h3 align="center"> 1.2</h3>
-
- <p> The Tao gave birth to machine language. Machine language gave birth to
- the assembler.
-
- </p><p> The assembler gave birth to the compiler. Now there are ten thousand
- languages.
-
- </p><p> Each language has its purpose, however humble. Each language expresses
- the Yin and Yang of software. Each language has its place within the
- Tao.
-
- </p><p> But do not program in <tt>COBOL</tt> if you can avoid it.
-
- </p><h3 align="center"> 1.3</h3>
-
- <p> In the beginning was the Tao. The Tao gave birth to Space and Time.
- Therefore Space and Time are Yin and Yang of programming.
-
- </p><p> Programmers that do not comprehend the Tao are always running out of
- time and space for their programs. Programmers that comprehend the
- Tao always have enough time and space to accomplish their goals.
-
- </p><p> How could it be otherwise?
-
- </p><h3 align="center"> 1.4</h3>
-
- <p> The wise programmer is told about Tao and follows it. The average
- programmer is told about Tao and searches for it. The foolish
- programmer is told about Tao and laughs at it.
-
- </p><p> If it were not for laughter, there would be no Tao.
-
- </p><p> The highest sounds are hardest to hear. <br/>
- Going forward is a way to retreat. <br/>
- Great talent shows itself late in life. <br/>
- Even a perfect program still has bugs. <br/>
-
- </p><hr/>
-
-
-
- <p> Thus spake the master programmer:
-
- </p><p> ``After three days without programming, life becomes meaningless.''
-
- </p><h3 align="center"> 2.1</h3>
-
- <p> The programmers of old were mysterious and profound. We cannot fathom
- their thoughts, so all we do is describe their appearance.
-
- </p><p> Aware, like a fox crossing the water. Alert, like a general on the
- battlefield. Kind, like a hostess greeting her guests. Simple, like
- uncarved blocks of wood. Opaque, like black pools in darkened caves.
-
- </p><p> Who can tell the secrets of their hearts and minds?
-
- </p><p> The answer exists only in Tao.
-
- </p><h3 align="center"> 2.2</h3>
-
- <p> Grand Master Turing once dreamed that he was a machine. When he awoke
- he exclaimed:
-
- </p><blockquote>
- ``I don't know whether I am Turing dreaming that I am a machine,
- or a machine dreaming that I am Turing!''
- </blockquote>
-
- <h3 align="center"> 2.3</h3>
-
- <p> A programmer from a very large computer company went to a software
- conference and then returned to report to his manager, saying: ``What
- sort of programmers work for other companies? They behaved badly and
- were unconcerned with appearances. Their hair was long and unkempt
- and their clothes were wrinkled and old. They crashed our hospitality
- suite and they made rude noises during my presentation.''
-
- </p><p> The manager said: ``I should have never sent you to the conference.
- Those programmers live beyond the physical world. They consider life
- absurd, an accidental coincidence. They come and go without knowing
- limitations. Without a care, they live only for their programs. Why
- should they bother with social conventions?
-
- </p><p> ``They are alive within the Tao.''
-
- </p><h3 align="center"> 2.4</h3>
-
- <p> A novice asked the Master: ``Here is a programmer that never designs,
- documents or tests his programs. Yet all who know him consider him
- one of the best programmers in the world. Why is this?''
-
- </p><p> The Master replies: ``That programmer has mastered the Tao. He has
- gone beyond the need for design; he does not become angry when the
- system crashes, but accepts the universe without concern. He has gone
- beyond the need for documentation; he no longer cares if anyone else
- sees his code. He has gone beyond the need for testing; each of his
- programs are perfect within themselves, serene and elegant, their
- purpose self-evident. Truly, he has entered the mystery of Tao.''
-
- </p><hr/>
-
-
-
- <p> Thus spake the master programmer:
-
- </p><p> ``When the program is being tested, it is too late to make design
- changes.''
-
- </p><h3 align="center"> 3.1</h3>
-
- <p> There once was a man who went to a computer trade show. Each day as
- he entered, the man told the guard at the door:
-
- </p><blockquote>
- ``I am a great thief, renowned for my feats of shoplifting. Be
- forewarned, for this trade show shall not escape unplundered.''
- </blockquote>
-
- <p> This speech disturbed the guard greatly, because there were millions
- of dollars of computer equipment inside, so he watched the man
- carefully. But the man merely wandered from booth to booth, humming
- quietly to himself.
-
- </p><p> When the man left, the guard took him aside and searched his clothes,
- but nothing was to be found.
-
- </p><p> On the next day of the trade show, the man returned and chided the guard
- saying: ``I escaped with a vast booty yesterday, but today will be even
- better.'' So the guard watched him ever more closely, but to no avail.
-
- </p><p> On the final day of the trade show, the guard could restrain his curiosity
- no longer. ``Sir Thief,'' he said, ``I am so perplexed, I cannot live in
- peace. Please enlighten me. What is it that you are stealing?''
-
- </p><p> The man smiled. ``I am stealing ideas,'' he said.
-
- </p><h3 align="center"> 3.2</h3>
-
- <p> There once was a master programmer who wrote unstructured programs.
- A novice programmer, seeking to imitate him, also began to write
- unstructured programs. When the novice asked the master to evaluate
- his progress, the master criticized him for writing unstructured
- programs, saying, ``What is appropriate for the master is not
- appropriate for the novice. You must understand the Tao before
- transcending structure.''
-
- </p><h3 align="center"> 3.3</h3>
-
- <p> There was once a programmer who was attached to the court of the
- warlord of Wu. The warlord asked the programmer: ``Which is easier to
- design: an accounting package or an operating system?''
-
- </p><p> ``An operating system,'' replied the programmer.
-
- </p><p> The warlord uttered an exclamation of disbelief. ``Surely an accounting
- package is trivial next to the complexity of an operating system,'' he said.
-
- </p><p> ``Not so,'' said the programmer, ``when designing an accounting package,
- the programmer operates as a mediator between people having different
- ideas: how it must operate, how its reports must appear, and how it
- must conform to the tax laws. By contrast, an operating system is not
- limited by outside appearances. When designing an operating system,
- the programmer seeks the simplest harmony between machine and ideas.
- This is why an operating system is easier to design.''
-
- </p><p> The warlord of Wu nodded and smiled. ``That is all good and well, but
- which is easier to debug?''
-
- </p><p> The programmer made no reply.
-
- </p><h3 align="center"> 3.4</h3>
-
- <p> A manager went to the master programmer and showed him the requirements
- document for a new application. The manager asked the master: ``How
- long will it take to design this system if I assign five programmers to it?''
-
- </p><p> ``It will take one year,'' said the master promptly.
-
- </p><p> ``But we need this system immediately or even sooner! How long will it
- take if I assign ten programmers to it?''
-
- </p><p> The master programmer frowned. ``In that case, it will take two years.''
-
- </p><p> ``And what if I assign a hundred programmers to it?''
-
- </p><p> The master programmer shrugged. ``Then the design will never be
- completed,'' he said.
-
- </p><hr/>
-
-
-
- <p> Thus spake the master programmer:
-
- </p><p> ``A well-written program is its own heaven; a poorly-written program is its
- own hell.''
-
- </p><h3 align="center"> 4.1</h3>
-
- <p> A program should be light and agile, its subroutines connected like a
- string of pearls. The spirit and intent of the program should be
- retained throughout. There should be neither too little or too much,
- neither needless loops nor useless variables, neither lack of
- structure nor overwhelming rigidity.
-
- </p><p> A program should follow the `Law of Least Astonishment'. What is this
- law? It is simply that the program should always respond to the user
- in the way that astonishes him least.
-
- </p><p> A program, no matter how complex, should act as a single unit. The program
- should be directed by the logic within rather than by outward appearances.
-
- </p><p> If the program fails in these requirements, it will be in a state of
- disorder and confusion. The only way to correct this is to rewrite
- the program.
-
- </p><h3 align="center"> 4.2</h3>
-
- <p> A novice asked the master: ``I have a program that sometime runs and
- sometimes aborts. I have followed the rules of programming, yet I am
- totally baffled. What is the reason for this?''
-
- </p><p> The master replied: ``You are confused because you do not understand
- Tao. Only a fool expects rational behavior from his fellow humans.
- Why do you expect it from a machine that humans have constructed?
- Computers simulate determinism; only Tao is perfect.
-
- </p><p> ``The rules of programming are transitory; only Tao is eternal.
- Therefore you must contemplate Tao before you receive enlightenment.''
-
- </p><p> ``But how will I know when I have received enlightenment?'' asked the
- novice.
-
- </p><p> ``Your program will then run correctly,'' replied the master.
-
- </p><h3 align="center"> 4.3</h3>
-
- <p> A master was explaining the nature of Tao of to one of his novices.
- ``The Tao is embodied in all software - regardless of how
- insignificant,'' said the master.
-
- </p><p> ``Is the Tao in a hand-held calculator?'' asked the novice.
-
- </p><p> ``It is,'' came the reply.
-
- </p><p> ``Is the Tao in a video game?'' continued the novice.
-
- </p><p> ``It is even in a video game,'' said the master.
-
- </p><p> ``And is the Tao in the DOS for a personal computer?''
-
- </p><p> The master coughed and shifted his position slightly. ``The lesson
- is over for today,'' he said.
-
- </p><h3 align="center"> 4.4</h3>
-
- <p> Prince Wang's programmer was coding software. His fingers danced upon
- the keyboard. The program compiled without an error message, and the
- program ran like a gentle wind.
-
- </p><p> ``Excellent!'' the Prince exclaimed, ``Your technique is faultless!''
-
- </p><p> ``Technique?'' said the programmer turning from his terminal, ``What I
- follow is Tao - beyond all techniques! When I first began to program
- I would see before me the whole problem in one mass. After three
- years I no longer saw this mass. Instead, I used subroutines. But now
- I see nothing. My whole being exists in a formless void. My senses
- are idle. My spirit, free to work without plan, follows its own
- instinct. In short, my program writes itself. True, sometimes there
- are difficult problems. I see them coming, I slow down, I watch
- silently. Then I change a single line of code and the difficulties
- vanish like puffs of idle smoke. I then compile the program. I sit
- still and let the joy of the work fill my being. I close my eyes for
- a moment and then log off.''
-
- </p><p> Prince Wang said, ``Would that all of my programmers were as wise!''
-
- </p><hr/>
-
-
-
- <p> Thus spake the master programmer:
-
- </p><p> ``Though a program be but three lines long, someday it will have to be
- maintained.''
-
- </p><h3 align="center"> 5.1</h3>
-
- <p> A well-used door needs no oil on its hinges. <br/>
- A swift-flowing stream does not grow stagnant. <br/>
- Neither sound nor thoughts can travel through a vacuum. <br/>
- Software rots if not used. <br/>
-
- </p><p> These are great mysteries.
-
- </p><h3 align="center"> 5.2</h3>
-
- <p> A manager asked a programmer how long it would take him to finish
- the program on which he was working. ``It will be finished tomorrow,''
- the programmer promptly replied.
-
- </p><p> ``I think you are being unrealistic,'' said the manager, ``Truthfully,
- how long will it take?''
-
- </p><p> The programmer thought for a moment. ``I have some features that I
- wish to add. This will take at least two weeks,'' he finally said.
-
- </p><p> ``Even that is too much to expect,'' insisted the manager, ``I will be
- satisfied if you simply tell me when the program is complete.''
-
- </p><p> The programmer agreed to this.
-
- </p><p> Several years later, the manager retired. On the way to his retirement
- luncheon, he discovered the programmer asleep at his terminal. He had
- been programming all night.
-
- </p><h3 align="center"> 5.3</h3>
-
- <p> A novice programmer was once assigned to code a simple financial package.
-
- </p><p> The novice worked furiously for many days, but when his master reviewed
- his program, he discovered that it contained a screen editor, a set of
- generalized graphics routines, an artificial intelligence interface,
- but not the slightest mention of anything financial.
-
- </p><p> When the master asked about this, the novice became indignant. ``Don't
- be so impatient,'' he said, ``I'll put in the financial stuff eventually.''
-
- </p><h3 align="center"> 5.4</h3>
-
- <p> Does a good farmer neglect a crop he has planted? <br/>
- Does a good teacher overlook even the most humble student? <br/>
- Does a good father allow a single child to starve? <br/>
- Does a good programmer refuse to maintain his code? <br/>
-
- </p><hr/>
-
-
-
- <p> Thus spake the master programmer:
-
- </p><p> ``Let the programmers be many and the managers few - then all will be
- productive.''
-
- </p><h3 align="center"> 6.1</h3>
-
- <p> When managers hold endless meetings, the programmers write games.
- When accountants talk of quarterly profits, the development budget
- is about to be cut. When senior scientists talk blue sky, the clouds
- are about to roll in.
-
- </p><p> Truly, this is not the Tao of Programming.
-
- </p><p> When managers make commitments, game programs are ignored. When
- accountants make long-range plans, harmony and order are about to
- be restored. When senior scientists address the problems at hand,
- the problems will soon be solved.
-
- </p><p> Truly, this is the Tao of Programming.
-
- </p><h3 align="center"> 6.2</h3>
-
- <p> Why are programmers non-productive? <br/>
- Because their time is wasted in meetings.
-
- </p><p> Why are programmers rebellious? <br/>
- Because the management interferes too much.
-
- </p><p> Why are the programmers resigning one by one? <br/>
- Because they are burnt out.
-
- </p><p> Having worked for poor management, they no longer value their jobs.
-
- </p><h3 align="center"> 6.3</h3>
-
- <p> A manager was about to be fired, but a programmer who worked for him
- invented a new program that became popular and sold well. As a result,
- the manager retained his job.
-
- </p><p> The manager tried to give the programmer a bonus, but the programmer
- refused it, saying, ``I wrote the program because I thought it was
- an interesting concept, and thus I expect no reward.''
-
- </p><p> The manager upon hearing this remarked, ``This programmer, though he
- holds a position of small esteem, understands well the proper duty
- of an employee. Let us promote him to the exalted position of
- management consultant!''
-
- </p><p> But when told this, the programmer once more refused, saying,
- ``I exist so that I can program. If I were promoted, I would do
- nothing but waste everyone's time. Can I go now? I have a program
- that I'm working on."
-
- </p><h3 align="center"> 6.4</h3>
-
- <p> A manager went to his programmers and told them: ``As regards to
- your work hours: you are going to have to come in at nine in the
- morning and leave at five in the afternoon.'' At this, all of them
- became angry and several resigned on the spot.
-
- </p><p> So the manager said: ``All right, in that case you may set your own
- working hours, as long as you finish your projects on schedule.''
- The programmers, now satisfied, began to come in at noon and work
- to the wee hours of the morning.
-
- </p><hr/>
-
-
-
- <p> Thus spake the master programmer:
-
- </p><p> ``You can demonstrate a program for a corporate executive, but you can't
- make him computer literate.''
-
- </p><h3 align="center"> 7.1</h3>
-
- <p> A novice asked the master: ``In the east there is a great
- tree-structure that men call `Corporate Headquarters'. It is bloated
- out of shape with vice presidents and accountants. It issues a
- multitude of memos, each saying `Go, Hence!' or `Go, Hither!' and
- nobody knows what is meant. Every year new names are put onto the
- branches, but all to no avail. How can such an unnatural entity be?"
-
- </p><p> The master replied: ``You perceive this immense structure and are
- disturbed that it has no rational purpose. Can you not take
- amusement from its endless gyrations? Do you not enjoy the
- untroubled ease of programming beneath its sheltering branches?
- Why are you bothered by its uselessness?''
-
- </p><h3 align="center"> 7.2</h3>
-
- <p> In the east there is a shark which is larger than all other fish. It
- changes into a bird whose wings are like clouds filling the sky. When
- this bird moves across the land, it brings a message from Corporate
- Headquarters. This message it drops into the midst of the programmers,
- like a seagull making its mark upon the beach. Then the bird mounts
- on the wind and, with the blue sky at its back, returns home.
-
- </p><p> The novice programmer stares in wonder at the bird, for he understands
- it not. The average programmer dreads the coming of the bird, for he
- fears its message. The master programmer continues to work at his
- terminal, for he does not know that the bird has come and gone.
-
- </p><h3 align="center"> 7.3</h3>
-
- <p> The Magician of the Ivory Tower brought his latest invention for the
- master programmer to examine. The magician wheeled a large black box
- into the master's office while the master waited in silence.
-
- </p><p> ``This is an integrated, distributed, general-purpose workstation,''
- began the magician, ``ergonomically designed with a proprietary
- operating system, sixth generation languages, and multiple state of
- the art user interfaces. It took my assistants several hundred man
- years to construct. Is it not amazing?''
-
- </p><p> The master raised his eyebrows slightly. ``It is indeed amazing,'' he said.
-
- </p><p> ``Corporate Headquarters has commanded,'' continued the magician,
- ``that everyone use this workstation as a platform for new programs.
- Do you agree to this?''
-
- </p><p>
- ``Certainly,'' replied the master, ``I will have it transported to the
- data center immediately!'' And the magician returned to his tower,
- well pleased.
-
- </p><p> Several days later, a novice wandered into the office of the master
- programmer and said, ``I cannot find the listing for my new program.
- Do you know where it might be?''
-
- </p><p> ``Yes,'' replied the master, ``the listings are stacked on the platform
- in the data center.''
-
- </p><h3 align="center"> 7.4</h3>
-
- <p> The master programmer moves from program to program without fear.
- No change in management can harm him. He will not be fired, even if
- the project is cancelled. Why is this? He is filled with Tao.
-
- </p><hr/>
-
-
-
- <p> Thus spake the master programmer:
-
- </p><p> ``Without the wind, the grass does not move. Without software, hardware is
- useless.''
-
- </p><h3 align="center"> 8.1</h3>
-
- <p> A novice asked the master: ``I perceive that one computer company is
- much larger than all others. It towers above its competition like a
- giant among dwarfs. Any one of its divisions could comprise an entire
- business. Why is this so?''
-
- </p><p> The master replied, ``Why do you ask such foolish questions? That
- company is large because it is large. If it only made hardware,
- nobody would buy it. If it only made software, nobody would use it.
- If it only maintained systems, people would treat it like a servant.
- But because it combines all of these things, people think it one of
- the gods! By not seeking to strive, it conquers without effort.''
-
- </p><h3 align="center"> 8.2</h3>
-
- <p> A master programmer passed a novice programmer one day. The master
- noted the novice's preoccupation with a hand-held computer game.
- ``Excuse me,'' he said, ``may I examine it?''
-
- </p><p> The novice bolted to attention and handed the device to the master.
- ``I see that the device claims to have three levels of play: Easy,
- Medium, and Hard,'' said the master. ``Yet every such device has
- another level of play, where the device seeks not to conquer the
- human, nor to be conquered by the human.''
-
- </p><p> ``Pray, great master,'' implored the novice, ``how does one find this
- mysterious setting?''
-
- </p><p> The master dropped the device to the ground and crushed it underfoot.
- And suddenly the novice was enlightened.
-
- </p><h3 align="center"> 8.3</h3>
-
- <p> There was once a programmer who worked upon microprocessors. ``Look
- at how well off I am here,'' he said to a mainframe programmer who came
- to visit, ``I have my own operating system and file storage device.
- I do not have to share my resources with anyone. The software is self-
- consistent and easy-to-use. Why do you not quit your present job and
- join me here?''
-
- </p><p> The mainframe programmer then began to describe his system to his friend,
- saying ``The mainframe sits like an ancient sage meditating in the midst
- of the data center. Its disk drives lie end-to-end like a great ocean of
- machinery. The software is as multifaceted as a diamond, and as convoluted
- as a primeval jungle. The programs, each unique, move through the system
- like a swift-flowing river. That is why I am happy where I am.''
-
- </p><p> The microcomputer programmer, upon hearing this, fell silent. But the
- two programmers remained friends until the end of their days.
-
- </p><h3 align="center"> 8.4</h3>
-
- <p> Hardware met Software on the road to Changtse. Software said: ``You
- are Yin and I am Yang. If we travel together we will become famous
- and earn vast sums of money.'' And so the set forth together, thinking
- to conquer the world.
-
- </p><p> Presently they met Firmware, who was dressed in tattered rags and
- hobbled along propped on a thorny stick. Firmware said to them:
- ``The Tao lies beyond Yin and Yang. It is silent and still as a pool
- of water. It does not seek fame, therefore nobody knows its presence.
- It does not seek fortune, for it is complete within itself. It exists
- beyond space and time.''
-
- </p><p> Software and Hardware, ashamed, returned to their homes.
-
- </p><hr/>
-
-
-
- <p> Thus spake the master programmer:
-
- </p><p> ``It is time for you to leave.''
-
- </p><hr/>
-
- </body>
|