[20160807] [Three iterations of system design]

Source: Internet
Author: User

Objective

Recently encountered in the work on the process-oriented and object-oriented programming methods and system design method of confusion, did some in-depth thinking of three iterations of the system design. Make a note here to guide my future work.

The primary objective of the system design is to reduce the complexity of the system and to quickly iterate a clear and efficient system with minimal prototyping method. It is a problem to design the high cohesion and low-coupling modular designs in process-oriented programming, and how to combine the abstraction and encapsulation in object-oriented programming with the advantages of each and avoid the shortcomings. Object-oriented has introduced a lot of redundancy in abstraction and encapsulation, which reduces the efficiency, but simplifies the system structure. The process is designed to improve efficiency by using pointers, which makes the system structure less clear. How to combine the advantages of the process-oriented and clear-oriented process, referring to the code style of the master, proposed three iterations of the system design. It is divided into algorithm implementation, structure optimization and algorithm optimization three iterations. The sections below are described in each section.

Algorithm implementation

Algorithms are the way to solve problems. is the first consideration in programming. The program equals the data structure plus the algorithm. So the implementation of the algorithm is the shortest prototype method of the fastest system design. The so-called minimal prototyping method is to design the algorithm with the fastest way to see the results. Specifically, it is possible to observe the phenomenon in every step of the system design. In order to ensure that the system can work first.

Structural optimization

When the iteration of a small module of the system is completed, the structure of the algorithm needs to be optimized. In the process-oriented program design, combining abstraction to improve the cohesion of the module, combined with the package to improve the coupling of the module. Cohesion refers to the data structures and algorithms that are needed in relation to themselves, and the coupling is relative to others, the inputs that need to be relied upon and the outputs of others are relatively independent. The specific implementation is as follows.

First, the modules are packaged separately with separate header and source files. In the header file includes header file, macro definition, structure Declaration, function declaration four parts. Include the header file, global variables, function definition three parts in the source file. struct declarations and global variables correspond to member variables in object-oriented, equivalent to data structure design; function declarations and function definitions correspond to member methods in object-oriented, equivalent to algorithmic design. Avoid using global variables in program design, where global variables are needed, you can define pointer variables in the global variables section of the source file, and design initialization functions in the function definition to allocate memory and destroy functions to free memory. Rather with the idea of object-oriented constructors and destructors for memory allocation and recycling of objects. By using this method to optimize the code structure, we not only lose the efficiency of the process-oriented function to drive the program design, but also combine the object-oriented abstraction and encapsulation characteristics of the module. It is believed that the system structure can be optimized to some extent.

Algorithm optimization

When the system structure is optimized, the algorithm can be analyzed more clearly, and the algorithm is optimized to some extent by using fixed-point and bit operation.

Summarize

Using the method to the final goal of system design makes the system reach clear and efficient. This is not to be reached by three iterations at a time. To achieve the desired effect must be repeated using this method for multiple iterations. Learning without thinking is a myth, but not a scholar. It takes more learning, more thinking and more hands-on to be more diligent.

[20160807] [Three iterations of system design]

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.