Three ideas and a technology

xiaoxiao2021-03-06  22

First, sequential programming ideas

Computers are not smart, it will only act according to commands. After the last command is completed, the next command will be executed. This is the fundamental way of computer work. Therefore, the initial procedure is also useful in designing this kind of "step-by-step" idea. It is better than we boil: the first step, water; the second step, fire; third steps, the pot ... As long as this one is completed, the task will succeed. This is the simplest sequential programming idea.

This idea is used to write short simple programs. It should try to avoid long length when programming this idea.

Second, modular programming ideas

The sequence program can implement a single arithmetic function, but if people need a computer to complete more complex operations, the sequencer is difficult to win. Because the sequential procedure has only one "road", if you want to perform a complex operation, you will need a lot of jumps, and the program will be quite a less smuggle, not easy to maintain. The method of solving is modular programming ideas.

If people need a complex program, this program can implement a variety of functions, then we look at each function as a "module", each "module" is independent of each other, and does not interfere with each other. In addition to this, we have a "main line" independent of all "Modules", "main line" to call each "module" as needed, "Module" only performs its own operations when called.

This kind of thought is to solve more complicated repetitive operations. It is based on the sequential procedure: whether it is "main line" or "module", is a simple sequential program, but there is an organic combination between them. .

Third, object-oriented programming ideas

Everything in nature can be considered "objects". Every "object" is the "object" we study. It is worth noting that we will classify these "objects" in our daily life. For example, there are many men and women in the street, we are all in "human beings"; whistling Mercedes-Bena Honda Hongqi, we are all in "car"; roadside high-rise building grass house, we are all building"……

Why do we consciously classify? Because of the total "objects" of these forests have some "commonality", let us instinctively think they are all "classes". For example, men and women will say that people have blood, so we will return men and women in the "human". The characteristics of this big category are "commonality" for men and women, but does not contain any "personality". This sentence may wish to change the way: men and women are "human", with all the features of "human", and have this large class does not have a strong "personality". In the language of a relatively written language, it is: male and female, "inherits" "human" characteristics, and "derived" different "personality". This is called "inheritance and derived".

Similarly, our writing procedures should also use this idea. We first create a "class" with public performance, whenever we need more special performance, we can "derive" from this "class", new "objects". Since all the products derived have all the features of "big category", we only need to have a small amount of modifications to make a small amount of modifications.

This idea is mostly used in large software development and is the mainstream programming idea of ​​large engineering. Its essence is to save a lot of cost of writing duplicate code, and efficiency is unmatched by a one-time modular program.

Four, interface

Sometimes there may be a program to complete the task, but when you develop large software development, a single program is unable to compete for huge tasks. Programs may need to cooperate with each other to achieve complex functions. So, how do you cooperate?

The project is might as a machine, and one of the procedures see a separate machine parts such as black boxes. The black box hides the internal structure, which only exposes the interface to input the interface and output processing results. As long as we connect it to the machine, we can accept the data from other parts, then pass the result of the result to the next recipient, complete its work. If you think that the machine has a problem, or if you want to improve, you can only need to modify the corresponding parts, and you don't have to remove the red do the entire machine. This is the advantages of interface technology. The interface is very beneficial to the maintenance or update of the project. You can even use the third part to develop parts to make your machine, so as you have updated and published by third parties, your machine is constantly updating.

转载请注明原文地址:https://www.9cbs.com/read-43329.html

New Post(0)