Programming path-The Tao of programming (I)

Source: Internet
Author: User

The Tao of Programming
Programming path

Book 1 -- the silent void
Book 2 -- the specified ent masters
Book 3 -- Design
Book 4 -- Coding


The silent void
Book One

Thus spake the master programmer:
The programmer said:

"When you have learned to snatch the error code from the trap frame, it will be time for you to leave ."
"When you take the crystal ball from my hand, it's time you leave ."

1.1

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.
A mysterious thing is born in the silent void. This kind of thing will never disappear, and it is the root of all programs. I don't know how to describe it, just call it a programming path.

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 greater, then the applications is great. the user is pleased and there is harmony in the world.
If the channel is perfect, the operating system is perfect. If the operating system is perfect, the compilation is perfect. If the compilation is perfect, then the application is perfect, so the user is satisfied and the whole world is harmonious.

The Tao of programming flows far away and returns on the wind of morning.
The way of programming goes like a yellow crane.

1.2

The Tao gave birth to machine language. Machine language gave birth to the author er.
Daosheng machine language, machine language compilation.

The specified ER gave birth to the compiler. Now there are ten thousand ages.
Compilers generate compilers and finally generate tens of thousands of advanced languages.

Each language has its purpose, however humble. Each language expresses the yin and yang of software.
Each language has its place within the Tao.
No matter how insignificant, each language has its own purpose, and each language expresses the yin and yang poles of software. Each language has its own path.

But do not program in COBOL if you can avoid it.
But try not to use the COBOL language.

1.3

In the beginning was the TAO. The Tao gave birth to space and time. Therefore, space and time are the yin and yang of programming.
At the beginning of the road, it brings space and time. Therefore, space and time are the yin and yang poles of programming.

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.
Programmers who do not know how to program often consume space and time, while programmers who do not know how to do so always have enough space and time to complete programming tasks.

How cocould it be otherwise?
Otherwise, what will happen?

1.4

The wise programmer is told about the Tao and follows it. The average programmer is told about the Tao and searches for it. The foolish programmer is told about the Tao and laughs at it.
Shi Wen said, thus the line. Sergeant said, please look for it. Corporal said, laughing.

If it were not for laughter, there wocould be no Tao.
Laugh and say.

The highest sounds are the hardest to hear. Going forward is a way to retreat. Greater talent shows itself late in life. Even a perfect program still has bugs.
Xi Yin does not hear, enter is to move back, the audience is late. Any program has vulnerabilities.


The specified ent masters
Book two

Thus spake the master programmer:
The programmer said:

"After three days without programming, life becomes meaningless ."
Three days without programming, meat is tasteless.

2.1

The programmers of old were mysterious and profound. We cannot fathom their thoughts, so all we do is describe their appearance.
Programming masters in ancient times are uncertain. We cannot speculate on what they think, but can only describe what they see.

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.
He Daming, such as a fox crossing the water; an alert, such as a general on the battlefield; kindness, such as a housewife serving guests; simple, dull, chaotic, such as the water of the abyss.

Who can tell the secrets of their hearts and minds?
Who can do what they do?

The answer exists only in the Tao.
The answer only exists in the Tao.

2.2

Grand Master Turing once dreamed that he was a machine. When he awke he exclaimed:
Super master Turing dreamed that he was a machine. After waking up, he recalled:

"I don't know whether I am Turing dreaming that I am a machine, or a machine dreaming that I am Turing! "
"I don't know if I dream of turning myself into a machine or a machine dream of turning myself into a Turing ."

2.3

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 submit with appearances. Their hair was long and unkempt and their clothes were wrinkled and old. They crashed out of our suites and they made rude noises during my presentation ."
A programmer from a large company attended a software meeting and reported to his supervisor: "Who are the programmers of other companies? They behave indecent, without borders, hair disorder, worn clothes, and are not hospitable at all. They are still shouting when I speak ."

The manager said: "I shoshould 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 shoshould they bother with social conventions? "
His supervisor said: "I should not have you attend this meeting. These programmers live outside the real world. They think life is ridiculous, just by accident. They come and go freely and have no worries. They only live for their programs. Why bother them with secular troubles ?"

"They are alive within the TAO ."
"They live in the TAO ".

2.4

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? "
A beginner asked the manager in charge: "There is a programmer who has never designed, written, or even tested his program in advance, but people who know him think that he is the greatest programmer in the world. Why?"

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 the TAO."
The manager said: "The programmer has mastered this. He doesn't need to be designed in advance. He never gets bored when the system crashes. He just accepts what happens, regardless of whether it is good or bad. He does not need to write documents. He never cares whether or not he has read the code. He does not need to perform tests either. Every program he writes has a perfect self, calm and elegant, and their purpose is self-evident. He has mastered the essence of the TAO ."


Design
Book Three

Thus spake the master programmer:
The programmer said:

"When program is being tested, it is too late to make design changes ."
"It is too late to change the design of a program when it is tested ."

3.1

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:
A person once attended a computer exhibition and said to the guard every day:

"I am a great thief, renowned for my feats of shoplifting. Be forewarned, for this trade show shall not escape unplundered ."
"First, I warn you that I am a master of theft, and my skills in Burglary are well known. ."

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 wanderson from Booth to Booth, humming quietly to himself.
As a result, the guard kept a close eye on the man because he had millions of computers in it. But the man simply went from one stall to another and muttered to himself calmly.

When the man left, the guard took him aside and searched his clothes, but nothing was to be found.
When the person left, the guard searched him, but nothing was found.

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.
On the second day of the exhibition, the person again said to the guard, "I returned yesterday, but today I will get more ." Therefore, the guard kept an eye on him with greater care, but it was completely useless.

On the final day of the trade show, the guard cocould 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? "
On the last day of the exhibition, the guard could no longer hold back his curiosity. "Mr. thief," he said. "You said I was in a panic. Please tell me what you stole ?".

The man smiled. "I am stealing ideas," he said.
The man smiled and said, "I am stealing ideas ."

3.2

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."
There is a programming master who writes unstructured programs. A beginner deliberately imitates him and writes unstructured programs. When he asked the master to see his progress, the master criticized his unstructured program: "The right thing for a programmer may not be the same for a beginner. Before going beyond the structure, you must understand programming."

3.3

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? "
Someone asked a programmer, "which is easier to design a financial software and an operating system ?"

"An operating system," replied the programmer.
"It's an operating system," the programmer replied.

The warlord uttered an exclamation of disbelief. "surely an accounting package is trivial next to the complexity of an operating system," he said.
This person is puzzled. "Obviously a financial software is less complex than 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 my 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 programmer said: "No, when designing financial software, a programmer must be an intermediary between a user with different opinions and a computer. He must understand the user's operation habits and what form of reports should be used, how to follow the tax law. On the contrary, an operating system has nothing to do with these external things. To design an operating system, programmers only need to achieve simple harmony between their ideas and machines. That's why the operating system is easier to design than financial software ."

The warlord of Wu nodded and smiled. "That is all good and well, but which is easier to debug? "
These people said with a smile. "Yes, but which one is easier to debug ?"

The programmer made no reply.
The programmer did not answer.

3.4

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? "
A project manager needs a project from the programmer and then asks the master: "If I want to give you five programmers, how long will it take to design this project ?"

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

"But we need this system immediately or even sooner! How long will it take it I assign ten programmers to it? "
"But we can't wait that long. The sooner the better, what if 10 programmers ?"

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

"And what if I assign a hundred programmers to it? "
"What about programmers in 100 ?"

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


Coding
Book Four

Thus spake the master programmer:
The programmer said:

"A well-written program is its own heaven;
A poorly-written program is its own hell ."
"A well-written program is its own heaven, and a poorly-written program is its own hell"

4.1

A program shoshould be light and agile, its subroutines connected like a strings of pearls. the spirit and intent of the program shocould be retained throughout. there shoshould be neither too little nor too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity.
A program should be flexible and its sub-process is like a string of pearls on an online line. From beginning to end, the goal is clear. One byte is too long, and one byte is too short. There are no unnecessary loops and no referenced variables, neither lack of structure nor rigidity.

A program shocould follow the law of least astonishment. What is this law? It is simply that the program shoshould always respond to the user in the way that astonishes him least.
A program should follow the ''least surprised th'' principle. What is the ''least surprised th'' principle ''? That is to say, a program should minimize the user's surprise.

A program, no matter how complex, shocould act as a single unit. The program shocould be directed by the logic within rather than by outward appearances.
No matter how complicated a program is, it should be a single whole. A program is guided by its internal logic rather than its appearance.

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.
If a program cannot meet its needs, it will be in disorder and disorder. The only way out is to rewrite this program.

4.2

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? "
A beginner asked the master: "a program of mine is sometimes normal and sometimes abnormal. I have fully followed the programming rules, and I am totally confused by it. 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 have CT it from a machine that humans have constructed? Computers simulate determinism; only the Tao is perfect.
The Master said, "You are confused because you do not know. Only a fool can believe that the result can be taken for granted as long as he follows what others say. Why do you want to get the result of taking it for granted from a machine constructed by humans? Computers are just the product of determination; only the Tao is the only perfect.

The rules of programming are transitory; only the Tao is eternal. Therefore you must contemplate the Tao before you receive enlightenment ."
All programming rules are only applicable to specific situations, and only Tao remains unchanged. Therefore, you should first think about it before you are guided ."

"But how will I know when I have received enlightenment? "Asked the novice.
"But how do I know when I will be guided ?"

"Your program will then run correctly," replied the master.
"When your program runs correctly ". Said the master.

4.3

A master was explaining the nature of the TAO to one of his novices, "the Tao is embodied in all software -- regardless of how insignificant," said the master.
For beginners, ask the masters to explain "tao nature ". The Master said: "The channel is stored in any software-no matter how meaningless the software is ".

"Is the Tao in a hand-held calculator? "Asked the novice.
"Does it also exist in handheld computing ?", Questions for beginners.

"It is," came the reply.
"Yes ,"

"Is the Tao in a video game? "Continued the novice.
"In the game console too ?", The beginner asked again.

"It is even in a video game," said the master.
"Yes, it even exists in game consoles ". Said the master.

"And is the Tao in the DOS for a personal computer? "
"Is it also in the DOS of my computer ?"

The master coughed and shifted his position slightly. "The lesson is over for today," he said.
The master coughed and said, "Today's class is here ".

4.4

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 a gentle wind.
When programming masters write software, fingers fly on the keyboard quickly. When the program is compiled, there is no error message, and the program runs like a breeze.

Excellent! "The price exclaimed," Your technique is faultless! "
Wonderful! Your skills are impeccable.

"Technique? "Said the programmer, turning from his terminal," What I follow is the TAO -- beyond all technique. when I first began to program I wocould see before me the whole program 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 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."
"Tips ?", The master turned and said, "What I followed is the Tao-it is beyond all the skills. When I started programming, I saw a large program, and three years later I saw a sub-process. Now I can't see anything. My whole existence is nothing in any form. I felt very leisurely. In short, my program was actually writing it myself. Sometimes I saw some problems. I saw them and stopped to observe them quietly. Then I changed a line of code, the problem is just like smoke. Then I compile the program. Sit there and enjoy the joy of work. Close your eyes for a while and then exit the system.

Price Wang said, "wocould that all of my programmers were as wise! "
"When can my programmers reach this level !"

Every time you see these strange words, you will get a different answer, and each answer shows that you are slowly moving closer to programming, and hope you will have some special GAINS!

Not complete >>>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.