Assembly language Programming (III.)

Source: Internet
Author: User
Tags abstract execution join time limit

Section Fourth programming

Programming refers to the concept of overall design, in advance to complete the program in a comprehensive and systematic analysis, and then set a clear framework for the production.
The ideal way is from the user's point of view, first determine the application function, using the key, input form, space structure and module division.
These are all confirmed, can netizens, according to the blueprint to write the program. In other words, planning is to first set the target properly, in order to orderly, sequential implementation.
1, the work of Understanding: Program planning, equivalent to the design of building basket map, first of all to clearly understand the nature of the work, characteristics, conditions, choose the appropriate way, in order to get the most ideal results.

2, the structure of the program: the structure to be finalized beforehand, is the adoption of processes or modules? All or part of the combination language? is according to the staff's quality division of labor, or is the production line unified production? The space allocation of the program section, the data section and the stack segment, the arrangement of each program join order, the definition of the register, the setting of the buffer, etc., should be carefully considered and recorded to provide the basis for the work.

3, parameter setting: The parameter is the program processing object, must reasonably arrange, and must have the expansion leeway. Because parameters are related to functional classification and the efficiency of the program, for programmers, parameters are equivalent to the processing object of the program, and to the application person is equal to the classification criteria for the work. The results of its arrangement have a great impact on the functional value.

4, efficiency requirements: In the first chapter of the third section, we particularly emphasize the principle of efficiency, the purpose of using the computer is the pursuit of efficiency. Therefore, at the beginning of planning, we should stipulate the efficiency requirements for each section of the program.
In addition, the use of parameters, it should also consider the frequency of its usage, where the prior preparation of a proper, must not wait until the use of temporary calculation.

5, test the standard: The test is the quality management, the program should achieve the target, can be verified by the test. The general programmer is only responsible for the correctness of the program. In fact, the correctness is not related to the indicator, but the programmer's minimum responsibility.
The quality of the combinatorial language program should include the writing specification and time limit of the original program, the idea of the program, the time of execution, the size and arrangement of the programming space, the convenience of the application, the appropriateness of the instruction application, and so on.
The quality control of the executing program can be done through the test program. This kind of test program should also be considered at the beginning of planning.

6, the progress of the production: the process of programming is difficult to control, but because it is difficult to control, but also to be more careful, planning beforehand. The method is to set the work "difficulty value" according to the nature of work first. Then, evaluate the "ability value" of the working programmer and set a "reasonable" schedule accordingly. Finally, according to the actual work schedule adjustment. Generally speaking, programmers need more than three years of writing experience to develop the concept of progress.
Because the program itself occupies space, so the structure of the good and bad, the program production and implementation of the efficiency of great impact. Good structure should be based on the nature of the program, the frequency of use, the process of processing, and so on, in the position of efficiency, for comprehensive consideration.

First, the nature of the program

The previous article introduced the type of process, in planning, to further understand the nature of the program. Because of the so-called efficiency, one refers to the production of the program, maintenance, one refers to the implementation of the program and call. The two must be properly arranged according to the nature of the procedure.
Generally speaking, the nature of the program is only two, one is active, the user can directly control the execution, the other is passive, public, for other programs to call.
The former can also be said to be an application, and the latter is similar to a system program. The only emphasis here is on its nature and how it is planned according to its nature.
The active program is best placed in the same module, when the program is too large, must be split, also try to join together. However, if the function is different and the module is not in the same intersection, in order to avoid the loss of efficiency across the segment and the segment, it is not necessary to consider whether to be placed in the same module.
Because the active program involves the use of human habits and the concept of designers, often need to modify the adjustment, great changes. Because of this factor, its "reuse" value is not high, the demand for efficiency is also low.
When planning, the active program must be separate from the passive program, while in the production, you should pay attention to the space occupied by it, and the relationship between the segments.
Since the passive program is public, it must have some basic functions. The so-called passive means that the program is invoked only under certain conditions. Because of its "reuse" features, should be designed to become a streamlined subroutine. If necessary, or to save space, put on disk, at any time to overwrite other subroutine calls, or for efficiency, direct join standby.

Ii. Frequency of Use

In terms of the efficiency of program execution, it is often necessary to make trade-offs between space usage and processing time. If the program is too large, the space is not enough to apply, in the planning, the first statistics of the use of each program frequency.
A program that is not commonly used does not mean that it does not matter, but if it occupies space, it is inefficient.
This program is ideally designed to be independent of a module so that it can be prepared at any time due to space conditions.
Therefore, in programming, space arrangements should be given priority to the frequency of use.

Third, the program process

The program has a certain operating law, called "process", meaning that in the execution, in accordance with the order of the pre-arranged, one through the process.
The traditional programming method, the process is very important, because people need to be based on a concept to gradually test and put into practice. But since the module has been taken seriously, each module represents a complete function, and the function of the collection can achieve the effect, far from the flow can be expressed. As a result, the importance of the process is reduced, and its position falls into only part of the structure.
Because the modules are modular, the more modules they have, the shorter the main flow. Although each module also has its own process, the structure of a good module, can be subdivided into several sub modules, and so on. Therefore, the process is far less flexible than the module, the concept is also inflexible.
However, even in the modular design process, it is sometimes necessary to step through the process of reasoning to understand the structure of detail. In this position, the flow of the application of the original understandable. But once took, the programmer does not have the process to think, is Grand.
Process is a one-way thinking, although people often use this process reasoning, but the more important ability comes from "abstract thinking." Abstract thinking refers to people in many complex, intertwined phenomena, can immediately grasp the focus, for the purpose of solving problems.
On the program, this kind of abstraction is equivalent to the overall understanding of all modules, not just the reasoning of the process. With a comprehensive understanding, the flexibility to call, the program's function is more the upper floor, greatly improved.
If the programmer only knows how to write the program according to the process, habit, not only the program is clumsy, even the way people think are affected. The general so-called "polished", "sluggish", is the result of this mechanical training.
Therefore, I do not agree to use the process to plan the program, but in interpreting or describing a process, does not exclude the convenience of the process.

Four, flow chart

The first step in the process is to draw a flowchart, make a detailed flow according to the flowchart, and then understand or write the program according to the detail process.
In the example above, the first process flow chart is as follows:

┌─────┐
┌>───┤ Form code Input │
│└──┬──┘
│┌──┴──┐
││ take a yard │
│└──┬──┘

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.