Simply put, programming is the process of using a certain programming language to write program code in order to achieve a certain purpose or solve a certain problem with the help of a computer, and finally obtain the result.
What is programming? Maybe it's like writing your own code and documentation and reading other people's code or documentation!
We put too much emphasis on writing our own code and documentation, but we don’t seem to care about the latter. This is just like articles
too many people can write, and too many writing experiences and rules already exist, but when reading articles, it is still
like a It is an art, so people often use words like "enlightenment" to describe understanding an article. The situation of the program
is similar to that of the article, but the program is more fixed and has more rules than the article. Therefore,
we have reason to believe that reading code is also an art. , but it should be a more regular art.
The following story is excerpted from "The Tao of Programming":
My story begins a few weeks after I graduated from college with a computer science major. My goal after college is to work for a research and development organization, preferably in a compiler or operating system design department. I finally found an organization that was willing to blindly hire me, but the condition was that I had to "learn the system" by completing program maintenance work over a period of time. .
Of course I would be resistant to this suggestion. I spent five years of college wasting time solving other programmers' mistakes! However, because they had promised to let me do a job that I was interested in in the future, I accepted it and reminded myself that even if I don't get famous in this job, I can still
Find another job.
When I reported for duty the second week, I was led to meet with the master of the program maintenance team. The head of the HR department took me quickly through the dark corridors of the development center. Finally, she pointed to a door at the end of the long hall passage and said, "He In there." After saying that, Zhi Shen left, seeming a little uneasy.
I walked towards the door and peered inside. I saw a man sitting in front of the terminal working, but his back was turned to me, so I didn’t know how old he was. Age, what you look like. I could only express my presence by coughing. Here, the master didn't even look back and said: "Please sit down."
Over his shoulder, I glanced at those incomprehensible screen displays. As his slender fingers flew on the keyboard, they appeared in front of him in a blink of an eye. on the terminal. Finally, with a grunt of satisfaction, he exited the system and turned to face me.
What I saw surprised me, because he didn't look like the kind of person who should be a Zen master. His face was boring,
almost ugly, and he Her hair is like a halo of trouble. But the first thing people noticed were his eyes, which emitted a faint blue light through the thick spectacle lenses.
He looked at me from head to toe, then nodded, as if to confirm a personal opinion, "Are you
the new guy?" he asked sourly. .
"Yes." I answered. I pretended to be passionate and gave him a quick report on my experience and achievements in college.
The man listened politely and then said: "That's good, but have you done program maintenance before?"
I frankly told him that I had not done so. .
The master sighed deeply, "Well, we should do what we do." He said. Then he took down a huge program list from a shelf, opened it casually, and handed it to me. Then he asked: "How do you deal with this?" I stared at the list, which was in assembly language, mixed with some strange macro languages. Every ten or so lines, control was transferred to some mysterious subroutine, and if the program had any structure, I couldn't tell. "What is this procedure?" I asked.
Master took the list from my lap. "This is the Coded Collection of Masters of the Generations," he said.
"When you learn to learn from the ecstasy When you catch the erroneous code, it's time for you to start." Then, he closed the list and put it back on the bookshelf.
I soon realized that program maintenance was much more difficult than I had imagined. I initially tried to learn the assembly language used in the Code Collection Sutra, but what bothered me was that I found that the assembly language had never been provided according to the rules. Looking at the documentation, there are only some notes that exist, written by a hardware developer who died or left the company many years ago.
This "Encoding Tibetan Scripture" cannot give me any help.
Although there are occasional comments, these comments are as vague as the assembly language, except for some disturbing information about the original hardware construction. Nothing else.
When I complained about all this to the master, he listened politely, and after the two of us were silent for a long time
he answered me:
p>
"You are trying to understand something that cannot be understood by your rational mind," he said, "and the result is failure. You must first clear your mind Only then can you begin to understand the Code Collection Sutra." Then, Master began to slowly explain the Code Collection Sutra to me. There is complex logic in it. As I listened to his gentle voice, I finally began to notice a flicker of light, which was the brilliant and eternal aura hidden in the Coded Tibetan Sutra. . "Those masters know nothing about 'good programming practices and rules,'" the master said. They strive to understand the inner workings of computer thinking in a general sense. They still need to
What documentation do I need? Those programs are expressions of extremes.
However, even as I slowly began to understand, I still felt like a little flying insect struggling in amber.
What Master taught was completely different from what I had learned, and it was difficult for my rational mind to accept it. But Master always patiently explained over and over again that I must not rely on rational thinking to reason, but must use my subconscious mind to understand the connotation of the Code Collection Sutra.
After months of guidance, I felt confident enough to try my first patch. In order to surprise my master, I worked secretly. I wrote a patch that re-ran a few lines of code, reassembled the program, and released the new program into the production system.
The next morning, I came a little late. What makes me feel strange is that the director of the development center and the manager of the development department are in the master's office. When I walked into the hall, the manager of the department saw me and closed the door.
I heard loud voices, but I couldn’t make out what they were saying.
After the two visitors left, I walked into Master's office. "What's going on?" I asked.
"Your patch entered the production system at six o'clock last night. It has now been deleted."
"So?"
" You can still keep working," the master said.
Finally, I finally understood that all my efforts to use my rational thinking to understand the Coded Tibetan Sutra were in vain,
This made me very desperate. Master noticed this change in my thinking, and he began to teach me about booting. He taught me meditation and troubleshooting techniques that he said had been passed down from generation to generation in technical support departments since the dawn of the computer age.
As I listened, I began to realize a huge truth about my previous programming experience. In college, I
believed that a programmer's job is mainly to control the activities of hardware and software. The highest artistic state of programming is,
In order to complete a task or achieve a goal And successfully use superb programming skills. But program maintenance is
different from program development. If you want to maintain a program, you must regard the program as a growing plant.
It is useless to encourage the growth of a program. In fact, such behavior is more likely to lead to plant death. A program
must be carefully nourished. Before making changes to the program, programmers must be very familiar with every logical relationship and must have a deep understanding of the intention of the program. This kind of understanding cannot be achieved overnight
It requires long-term accumulation.
After many months, I was finally able to successfully design a patch for "The Coded Tibetan Sutra", but before designing it
it took a long time of meditation and the copy of the The program list is propped open on my desk. I also discovered that if I light an incense stick while working, I keep repeating the mantra that Master taught me:
“Null-So-Stix-Etx- Eot" (the pronunciation of the first five bytes NUL, SOH, STX, ETX, EOT
in the ASCII code table - translation annotation), it is easier for me to concentrate. Master said that the mantra means the "five principles" of the universe.
Soon I found that I no longer cared about being rewarded for my work performance, and that I no longer saw any separation between myself and the
programs I maintained. Like a person who has lived in the shadows all his life, I began to understand the Zen of programming, which is an indescribable and indescribable force hidden behind the programmer's design, just like casting
p>
Like the sun that casts shadows.
After getting rid of the meaningless "self-existence", I began to realize that those great programming language
sentences seemed vague to me in the past. It's just that I haven't fully understood them yet. I now
know why programmers in the past never provided documentation for their programs, because English language description
is more confusing than inspiring. Inspire.
One day, I found that a problem I was solving involved the most complicated part of the "Encoding Tibetan Sutra" -
The entire error analysis process. Without knowing anything about it, I came up with a patch that would detect the error by checking the contents of the hardware interrupt area so that the program could continue to execute correctly.
That afternoon, Master walked into my workshop for the first time. He put his hands on my shoulders and looked down at me.
It’s your turn now. It’s time to leave,” he said.
Although computers are very powerful. It can allow you to surf the Internet, play games, manage company personnel relations, etc., but without programs, it is equivalent to a pile of scrap metal and will not pay attention to the "orders" we give it. Therefore, we have to tame it through only one way - program. This is also the only way for us to communicate with the computer.
So what exactly is the program?
A program is a collection of instructions that tells the computer how to perform a specific task.
For example, it is like a recipe that guides you to cook a dish or a traffic policeman (or traffic sign) that directs you to drive all the way to your destination. Without these special instructions, the intended task cannot be performed. The same goes for computers. When you want a computer to do something for you, the computer itself cannot actively work for us, so we must give it instructions, and it simply cannot and cannot understand human natural language about things. description, so we must use programs to tell the computer what to do and how to do it? Instructions are needed for even the simplest tasks, such as how to obtain a keystroke, how to place a letter on the screen, how to save a file to disk, and so on.
It’s so troublesome that you have to consider these things even when programming! No wonder people say programming is difficult! You are wrong. In fact, many of these instructions are ready-made and included in the processing chip and built into the operating system, so we don’t have to worry about them working. They are all completed by the processor and operating system and do not require us to Intervene in these processes.
The computer mentioned above does not actively do anything by itself. Therefore, we have to use programs to make the computer "serve" for us. And this process is what we "made up". Programming can be implemented using a certain programming language, and the syntax of this language is used to describe what the computer is supposed to do.
The grammar we are talking about here is completely different from the grammar in foreign languages. The grammar we are talking about here is just to read your program writing and make some rules.
After you write the program, special software will interpret or translate your program into a "computer language" that the computer can recognize. Then the computer can "understand" your words and follow your instructions. Did your bidding. Therefore, programming is actually a process of "people giving rules to computers".