Code Review-great energy for readability efforts

Source: Internet
Author: User

CodeThis topic of readability has always received much attention, but there is no unified standard for its high readability and low readability. After all, the specifications of various companies and even projects are different. We can't say that a code that is extremely abstract and flexible but hard to understand for ten days and a half is highly readable, it cannot be said that the readability of a code with thousands of lines but good logic from the beginning to the end is poor. So what kind of code is reasonable, so it is highly readable? I think there must be a commonality between the differences, that is, the code that has been reviewed and can be accepted by other members of the project team and can be understood as soon as possible is readable.

 

Why is code review required?

 

To review code readability, this requires human, material resources, and valuable time for the project. Cost is an important consideration for a project. However, review will undoubtedly increase the cost of the project. Why should we review it? In fact, any project manager knows that a successful project cannot be achieved overnight. The development process will inevitably encounter various problems and obstacles, which also verifies the old saying: "The only thing that will not change in software development is that the demand will change forever ". We also know that the sooner the problem is discovered, the smaller the loss will be, the less time it takes to remedy the problem, and the lower the natural cost. But how much chance can we find problems as soon as possible? This is not because we said that we had discovered the problem early. Then we would say, "Look at your attitude, let's discover it early !" This is simple. Why does iterative development appear? Why is waterfall development hard to cope with large-scale commercial and industrial projects? It is not difficult to think about it. It is difficult for customers to express what they want in a one-time, comprehensive, and detailed manner. Only when customers see what they actually want, he knows more about what he wants. For example, if you want to buy a pair of trousers, you tell a person to say, "I want a pair of simple jeans." Then the person will buy it for you, but are you sure you want the specific color? Is it black or blue? Are you sure you have any buttons or no buttons? Only when you really switch to the store and have tried it can you be sure: What I want is the xxx pants with no buttons on the blue 180 pocket. That is to say, we are rarely able to get problems from the customer's mouth as early as possible, unless we point to what we have made and say: Look, this is what you want. In this case, it is not necessary to detect problems as soon as possible, but to identify and solve problems as soon as possible after the problem arises, so as to reduce the project cost.

In fact, the main time of software development is spent on debugging. However, most of the time spent in debugging is in reading code. If the people who developed this module are already far away from the sky, no one would be able to afford thousands of lines of chaotic and unordered code. Therefore, the cost is worthwhile and necessary for code review. Unfortunately, few people are paying attention to code standardization and readability, even in large companies. The Project Manager pays too much attention to the progress of the project. As long as the developer finishes his or her tasks, few people will pay attention to the Code he or she writes, and even the developer will not go over it.

 

What are the benefits of code review?

 

First, code review can improve the software quality and maintainability. In this way, you can reduce the time to locate errors, improve the efficiency of solving bugs, improve the development efficiency, and reduce the maintenance costs in the future.

Secondly, the reviewed code can be quickly understood by other members of the project team. This helps other members of the Project better understand the business and facilitate communication between members, when the developer in charge of a module leaves the company, other developers can quickly take over the relevant development and cultivate new personnel to make up for the vacancy as soon as possible.

Finally, the Code review process is both a summary process and a communication process. It can effectively improve the technical level and business quality of developers and enhance the company's competitiveness, through summary and exchange, we can even extract commonalities from different projects and make relevant products to form the company's core competitiveness and lead the industry.

 

How to perform code review?

 

Participants should be the overall participants of the project. If the project is too large and the overall participation cost is high, the participants can be reviewed in a module group. Because the services they are responsible for are closely related and the technologies used are relatively close to each other, the development specifications should be uniform.

The content of the review should be the code naming rules and organizational structure. Each project has its own specifications. However, if different specifications are used within the project, it will inevitably increase the difficulty of discovering and solving problems, and increase the maintenance cost in the future.

In terms of the review time, it should be carried out after each module is developed, so that developers can easily exchange issues and experiences, and each person's presentation time should not exceed 30 minutes, because the business complexity of the module is not that complex, how to ensure that the Code is clear is unclear for 30 minutes.

From the results of the review, the code that has been reviewed should be recognized by most of the participating members, and the logic of the Code that each participant can understand is clear, and the communication improves the cohesion of the project members through communication, to improve business awareness, it is best to form products that can be used together between projects.

 

OriginalArticle, Reprinted, please indicate the source!
All copyright reserved!

 

Home: http://jingtao.cnblogs.com

QQ: 307073463
Email: jingtaodeemail@qq.com
MSN: sunjingtao@live.com

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.