Programming path (translated by Xiao Zhao)

Source: Internet
Author: User

4.1A 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.2A 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.

Related Article

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.