How to improve the quality of the code (Management chapter): Code review

2010-02-24  来源:本站原创  分类:Development  人气:208 

How to improve the quality of the code (Management chapter): Code review

Perhaps you are a project manager, perhaps you are a core member of the project or development team leader. I published "How to improve code quality" of the system after the article, many users have complained to me that he could not grasp the entire project team's code quality. I think this is common problem for all project team it, it manifests itself in the following questions:

Common problem of software project

1) novice. Any project team members are inevitably novice, they are often just graduated from college students. These novice as software development time is too short, often immature technology, the development does not form a good habit of writing code so the poor quality of many problems. They often become the team's "weak", with more project quality can not be guaranteed, then they do not have enough people.

2) personnel changes. A little bit longer maintenance time software projects, staff changes are inevitable. Older employees were transferred to other projects go, the new staff to take over their work. In my project group, the mobility was 90%, the only thing I transferred. The new staff take over the old code maintenance staff, and even proceed with new development, because the original code and design ideas to understand the bias, there will be a lot of bad code.

3) non-standard coding. Even excluding the impact of these two issues, the project team members write code that will have problems. In the beginning of project development, we tend to develop a coding specification, but in the project development process, many members tend to ignore these norms to arbitrary code written. Arbitrarily coding will reduce readability, maintainability and ease of change of. So what we should use management measures to ensure that the code specification, improve code quality?

These problems, which I constantly explored in the project development and think about, and some experienced project managers presented their solution, that is, "code review."

What is a code review

Code review (Code Review), also known as "code review" the basic idea is that developers write their code completed by other people to review his code, so as to effectively find defects in code. Code review of a basic theory is that the sooner we find defects in code, we solve the lower the cost of defects. Code review is often divided into the following one aspect of the review:

1) code style. In the beginning of project development, we tend to develop a coding specification, in fact, the code specification to include the entire project team's code style. As software developers design traditions, if not unified code style, a project code will be varied, such as the naming of variables and constants, interface and implementation class notes, when the carriage returns, indents, etc. how. A wide variety of design styles, will maintain and improve for the future difficult. Through the code review, on the one hand to urge developers to write code according to specification, it also enables developers to program their own form good habits. Code style review, since the content is relatively simple, we often through some code review tools to automate and improve the efficiency review.

2) The major defect. In some articles on the Code Review in a list of the list often to describe the code review should focus on Zhu Yi's Major defects , including: there is SQL injection, vulnerable to cross-site scripting, buffer overflow Ou, managed code, etc. . Project team can accumulate a significant defect review the project, and one by one check in each review. Major defect is a tedious and meticulous review of the work, if they can write or use some review of the software, can greatly improve the efficiency of our review.

3) review of the design logic and thinking. I think that part of the review of the code review is the most crucial and most valuable part. Code style review with major defects, although important, but simple and mechanical, can automatically check software; and design review of the logic and ideas, but it is complex and in-depth review of the need to have some theoretical depth and experience of the person to complete coding , and the novice is particularly important. Mentioned earlier, the novice is the inevitable question of any project team. Unfortunately, many project managers of the solution is simple and only a small amount of work to complete novices, but a large number of complex work to the small number of those veterans to complete. The result is that novices are always new to them without adequate training; veteran exhausted Lei Huo, can not be expected to share the work of novices. For this problem, my approach is through code review, to guide the novice to veteran, so as to enhance the overall quality of the team. Specific way, in the novice after the completion of coding, so veterans to conduct code review, pointed out that the novice's question, guide novice design. This process may need to reconstruct the original, or even re-encoding. However, after this process, the novice will gradually skilled, fast becoming a veteran, and the overall improvement in the quality team.

Advantages and disadvantages in the form of code review

After the above description, we can find the code review are clear advantages.

First of all, through the style and standard of review of the code, you can greatly improve code readability and maintainability. Now the software, often require ongoing maintenance and upgrades, staff changes are inevitable, so the code readability and maintainability is particularly important. Code review is an encouragement, because it is there, urging the developers to consciously regulate code, to develop good coding habits, improve code quality. An interesting question is, if you do not read other people's code, never understanding what the code is readable, and not let other people read their own code and feedback, and will never know that their code is readable, Even if you're a coding veteran of many years. Code review is precisely to solve this problem, which you can try.

Second, the code review is an exchange between programmers. Novice can have more opportunities and guidance to veterans to learn and improve their design level (it should be said that this is very valuable for them); veterans through the guidance of the novice, organize and sublimate their design ideas and theories, but also for the other hand, exercise and improve their own. In addition, when you find someone else pointed out a problem later, but also in the warning myself not to make the same mistakes, which were reviewed and the reviewers were helpful.

Although the code review to have such outstanding merit, but its drawback is also very significant that it needs to pay such a heavy price. When a person after the completion of coding, but also other people to interpret and review and required programmers to perform the corresponding modification, or reconstruction and rewriting, which itself is a heavy price. This in itself has been very tight and time of software development projects, is undoubtedly a worse. Time, manpower and code quality, which itself can not have both fish and bear's paw, the key is how to balance. Because of this, different companies chose a different strategy for the code review.

Not long ago, I heard a big game software company, South Korea on their code review. As the company in software development, time and manpower is not the most critical and critical code quality problems, so they adopted a strict code review strategy. Strict code review strategy, a way to code by hand for review. In this way, the staff of organizational form, separate from the software developer made a number of experienced people to form a code review team, allied to other software development team code review. In this way, the code review team to a third party to review the status code for each project team can ensure fair and impartial review, but the pressure will be enormous (think they want to see so much code).

Another way, is a project development team for the unit code-checking each other, that one's code, to all members of the Panel for review. There is no doubt in this way, its costs too. A variation on this approach is to XP in the way of pair programming to integrate, contingently, the two people on the programming code for each check each other. Pair programming with the project team can try in this way, unfortunately, is currently the use of pair programming, project team were too few. Above the maximum of two evils is the code review responsibility, that is the responsibility of the reviewers do not have much to be discovered by examination of those issues, the review found that the problem has nothing to do good, sculptors and were reviewed by grudges; the contrary, those who did not review found that the problem will not bear any responsibility. This result has led to code review a mere formality: a review of those cursory review of the parties happy, the problem still exists.

In summary, although the code review obvious advantages, but some forms can not be more than an ordinary software development team accepted this, I resorted to my best practice: as a group, head of the responsibility of the code review form.

Code review best practices

Code review is a cost, sometimes enormous, so the code review should not be frequent, the best review of a code only once. Meanwhile, the code review shall review the code on the responsibility, that is, to boldly review also said that the review of those issues and asked to be reviewers deadline for correction. At the same time, after review of the code is there if it is defective, the review shall responsible. Only meet the three conditions above, the code review can be acceptable for us. There is no doubt that the project development team leader to assume this responsibility is the most appropriate.

A project development group, classified according to their function, can be divided into several groups, each responsible for a sub-module. In such a group, the team leader is undoubtedly the most experienced developer, charged with this matter is responsible for organizing and guiding other members is appropriate. Members of the group not too much, often 3 to 5. Team leader not to allocate too many development tasks, his main job is to guide and supervise other members of the development team. The development of his mandate from the heavy freed, he can have more energy to guide the other members of the design and review their code. Ultimately, he wants to all members of the group responsible for the quality of code, the project manager or quality manager for sampling and checking of the overall situation.

If you are just a small project, staff within a total of 5 people, then you do not have such a group. As project manager you're the team leader, guidance and supervision of your members. This arrangement is because in modern management theory that a person can only manage five individuals, more than five individuals should be grouped management. 5 If you do not need to separate within the course Rights.

As a leader, you can effectively review and manage your team. Also, because you responsible, you have to seriously and effectively to complete the review. The above forms of organization, code review can easily and effectively carried out in the project team together, thereby effectively improving the management of software development, code quality.

Reprinted from: http://www.javaeye.com/topic/599976

相关文章
  • How to improve the quality of the code (Management chapter): Code review 2010-02-24

    How to improve the quality of the code (Management chapter): Code review Perhaps you are a project manager, perhaps you are a core member of the project or development team leader. I published "How to improve code quality" of the system after th

  • Managed using the google code project source code, to achieve off-site shared 2011-03-29

    In the development process, we often replacement of svn server, remote office or project team members and code that will not happen in time synchronization status. To solve this problem, we can try to use google code to host the project source code,

  • A lesson on how to improve the quality of the code (2) 2010-01-08

    3 to change of I mentioned earlier, the software changes all the software is the core of the theory, then what is the software can be changed as well? Software in accordance with the present theory, the customer demand for software is changing every

  • How to improve code quality (management articles): Code Review 2010-02-24

    How to improve code quality (management articles): Code Review Perhaps you are a project manager, you may be a key member of the project or development team leader. I published "How to improve code quality" of the system after the article, many

  • Improve the quality of the code with Eclipse plugins 2010-10-12

    Improve the quality of the code with Eclipse plug-in reference to the article. http://www.ibm.com/developerworks/cn/java/j-ap01117/

  • On the DRY principle of how to improve software quality 2009-03-25

    On the DRY principle of how to improve software quality Abstract: August 2008 to December 2008, the authors take part in a certain provincial-level wireless operators online business hall three development projects and served as project manager jobs.

  • 7 pragmatic approach to improve software quality 2010-08-31

    Software defect is known as "bugs" for a reason, they often exist in the software for a long time, they are always at the most inappropriate time to appear in the code, there is no efficient way to eliminate them These are and have a very simila

  • 7 a pragmatic approach to improve software quality 2010-08-31

    Software defect is known as "bugs" for a reason, they often exist in the software for a long time, they are always at the most inappropriate time to appear in the code, there is no efficient way to eliminate them These are and have a very simila

  • How to maintain the code quality - history of the evolution of code quality metrics 2010-10-20

    Sequence of Should now not many people would think that code quality is not important. Good quality code and code implementations can make the code more stable and more in maintenance. Unicode standard can make the code easier to read and understand.

  • Some of the ways to improve project quality 2011-05-09

    Done a lot of items, each generation has a different bug, how to reduce the number of generated bug, how to avoid repeating the mistakes, the ultimate aim is to improve the quality of projects, to become our developers need to focus on place . Change

  • DRY principle on how to improve software quality 2009-03-03

    DRY principle on how to improve software quality Abstract: August 2008 to December 2008, the author attended a provincial radio operator's online Office 3 project development, and served as project manager positions. Internet Office is the wireless o

  • Some of the ways to improve the quality of projects 2011-05-09

    Done a lot of items, each has a different bug in generation, how to reduce the number of generated bug, how to avoid repeating mistakes, the ultimate aim is to improve the quality of projects, our developers on areas of concern of the . Faced with a

  • Improve the quality of worsted fabric setting process improvement 2010-02-16

    Keyword: Improve the quality of worsted fabric setting process of improvement: Fang Xuejuan Abstract: worsted wool fabric after finishing, such as boiling, steaming it (can steam), pre-reduction and other processing, setting the fabric to achieve the

  • Improve the quality of knitted fabric dyeing process of reactive 2010-02-18

    Keywords: reactive dyeing knitted fabrics to improve the quality of the process of rapid pre-treatment process even before the treatment process it is necessary to absorb, through the net, but also simple, short, provincial. Introduction of non-use o

  • Improve the quality of the line pattern and effect of printing (below) 2010-02-18

    Keyword: Editor's Note] [Hu Sheng Mu line pattern is common in the textile printing pattern printing one welcomed by consumers, in the printing production of a considerable proportion. In the last issue, has already affect the printing quality of the

  • Use reflection to improve the quality of unit testing 2010-06-28

    First, unit testing and unit test coverage is only a tool for, crappier the same code can have a full suite of unit tests and unit test coverage is high (in this case refers only to code coverage, branch coverage is not involved, etc.). Second, unit

  • Refactoring of the code of the code refactoring (reference) 2010-03-29

    Developers may have heard "bad smell" the word, this word is used in the software coding does that mean? Still smell the code do? Of course not, as a computer virus, bug, like words, this is only a metaphor. The word here means the code to achie

  • Topo Introduction to statistical analysis code management 2010-12-20

    Topo team of enterprise software system to provide a lot of very useful code management capabilities, by means of these features, the software team can improve their work efficiency, Topo code management system include: the depth of view code, code s

  • Introduction to statistical analysis code management 2010-12-30

    Topo team of enterprise software system to provide a lot of very useful code management capabilities, by means of these features, the software team can improve their work efficiency, Topo code management system include: the depth of view code, code s

  • Two different versions of code management 2008-05-29

    A method: In each release, each person create their own branch, the code changes in their own branch in. Until two days before the release, in order to merge into the trunk where the code. Premise: 1. Release should be short enough. If your release i