The Tao of Programming

Extracted from Shuguang Hong's Jokes on OO and OO Programming

Thus spake the master programmer:
When you have learned to snatch the error code from the trap frame, it will be time for you to leave.

Thus spake the master programmer:
After three days without programming, life becomes meaningless.

Thus spake the master programmer:
When a program is being tested, it is too late to make design changes.

Thus spake the master programmer:
A well-written program is its own heaven; a poorly-written program is its own hell.

Thus spake the master programmer:
Though a program be but three lines long, someday it will have to be maintained.

Thus spake the master programmer:
You can demonstrate a program for a corporate executive, but you can't make him computer literate.

Thus spake the master programmer:
Let the programmers be many and the managers few -- then all will be productive.


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?"

The master replied, "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 the Tao."


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?"

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."

"Pray, great master," implored the novice, "how does one find this mysterious setting?"

The master dropped the device to the ground and crushed it under foot. And suddenly the novice was enlightened.


A manager went to a 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?"

" It will take one year," said the master promptly.

" But we need this system immediately if not sooner! How long will it take if I assign ten programmers to it?"

The master programmer frowned. "In that case, it will take two years."

"And what if I assign a hundred programmers to it?"

The master programmer shrugged. "Then the design will never be completed," he said.


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.
A novice programmer was assigned to code a simple financial package. 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, and an artificial intelligence interface, but not the slightest mention of anything financial.

When the master asked about this, the novice became indignant. "Don't be so impatient," he said, "I'll put the financial stuff in eventually."


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 exist?"

The master replied, "You perceive this immense structure and are disturbed that it has no rational purpose. Can you not take amusement form its endless gyrations? Do you not enjoy the untroubled ease of programming beneath its sheltering branches? Why are you bothered by its uselessness?"


There was once a programmer who worked on 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?"

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 end-to-end like a great ocean of machinery. The software is multi-faceted 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."

The microcomputer programmer, upon hearing this, fell silent. But the two programmers remained friends until the end of their days.


A novice asked the master, "I have a program that sometimes runs and sometimes aborts. I have followed the rules of programming, yet I am totally baffled. What is the reason for this?"

The master replied, "You are confused because you do not understand the 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 the Tao is perfect. The rules of programming are transitory; only the Tao is eternal. Therefore you must contemplate the Tao before you receive enlightenment."

"But how will I know when I have received enlightenment?" asked the novice.

"Your program will then run correctly," replied the master.


There once was 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?"

"An operating system," replied the programmer.

The warlord uttered an exclamation of disbelief. "Surely an accounting package is trivial next to the complexity of an operating system," he said.

"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."

The Warlord of Wu nodded and smiled. "That is all well and good, but which is easier to debug?"

The programmer made no reply.


Each language has its purpose, however humble.
Each language expresses the Yin and Yang of software.
Each language has its place within the Tao.

But do not program in COBOL if you can avoid it.


A master was explaining the meaning of the Tao to one of his novices, "The Tao is embodied in all software -- regardless of how insignificant," said the master.

"Is the Tao in a hand-held calculator?" asked the novice.

"It is," came the reply.

"Is the Tao in a video game?" continued the novice.

"It is even in a video game," said the master.

"And is the Tao in the DOS for a personal computer?"

The master coughed and shifted his position slightly. "The lesson is over for today," he said.


Price Wang's programmer was coding software. His fingers danced upon the keyboard. The program compiled without an error message, and the program ran like gentle wind.

"Excellent!" the Price exclaimed, "Your technique is flawless!"

"Technique?" said the programmer, turning from his terminal, "What I follow is the Tao -- beyond all technique. When I first began to program I would see before me the whole program in one mass. After three years I no longer saw this mass. Instead, I saw subroutines. But now I see nothing. My whole being exists in a formless void. My senses are idle. My spirit, free to work without a 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."

Price Wang said, "Would that all of my programmers were as wise!"


A well-used door needs no oil on its hinges.
A swift-flowing stream does not grow stagnant.
Neither sound not thoughts can travel through a vacuum.
Software rots if not used.

These are great mysteries.


Does a good farmer neglect a crop he has planted?
Does a good teacher overlook even the most humble student?
Does a good father allow a single child to starve?
Does a good programmer refuse to maintain his code?

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.

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.


Back to Gregory's homepage