Code Reviews
来源:互联网 发布:java 线程池初始化 编辑:程序博客网 时间:2024/05/18 03:29
You should do code reviews. Why? Because they increase code quality andreduce defect rate. But not necessarily for the reasons you might think.
Because they may previously have had some bad experiences with reviews, many programmers tend to dislike code reviews. I have seen organizations that require that all code pass a formal review before being deployed to production. Often it is the architect or a lead developer doing this review, a practice that can be described as architect reviews everything. This is stated in their software development process manual, so therefore the programmers must comply. There may be some organizations that need such a rigid and formal process, but most do not. In most organizations such an approach is counterproductive. Reviewees can feel like they are being judged by a parole board. Reviewers need both the time to read the code and the time to keep up to date with all the details of the system. The reviewers can rapidly become the bottleneck in this process, and the process soon degenerates.
Instead of simply correcting mistakes in code, the purpose of code reviews should be toshare knowledge and establish common coding guidelines. Sharing your code with other programmers enables collective code ownership. Let a random team memberwalk through the code with the rest of the team. Instead of looking for errors you should review the code by trying to learn it and understand it.
Be gentle during code reviews. Ensure that comments are constructive, not caustic. Introduce differentreview roles for the review meeting, to avoid having organizational seniority among team members affect the code review. Examples of roles could include having one reviewer focus on documentation, another on exceptions, and a third to look at the functionality. This approach helps to spread the review burden across the team members.
Have a regular code review day each week. Spend a couple of hours in a review meeting. Rotate the reviewee every meeting in a simple round-robin pattern. Remember to switch roles among team members every review meeting too.Involve newbies in code reviews. They may be inexperienced, but their fresh university knowledge can provide a different perspective.Involve experts for their experience and knowledge. They will identify error-prone code faster and with more accuracy. Code reviews will flow more easily if the team hascoding conventions that are checked by tools. That way, code formatting will never be discussed during the code review meeting.
Making code reviews fun is perhaps the most important contributor to success. Reviews are about the people reviewing. If the review meeting is painful or dull it will be hard to motivate anyone. Make it aninformal code review whose prime purpose is sharing knowledge between team members. Leave sarcastic comments outside and bring a cake or brown bag lunch instead.
by Mattias Karlsson
This work is licensed under a Creative Commons Attribution 3
- Code Reviews
- Why do code reviews?
- 如何做好code Reviews
- C# Code Reviews using StyleCop
- Starting code reviews with Crucible
- 转载:Effective Code Reviews Without the Pain
- Effective Code Reviews Without the Pain
- A checklist approach to security code reviews
- Automated code reviews with Checkstyle, Part 1
- Code reviews in the 21st Century
- Don't Waste Time on Code Reviews
- Best Practice Techniques for Code Reviews
- C++ Coding Standards Item 4: Invest in code reviews
- (转贴)Effective Code Reviews Without the Pain
- OWASP AppSecUSA 2012: Secure Code Reviews Magic or Art
- FAWN Reviews
- bigtable reviews
- Spotmau PowerSuite 2009 reviews
- Code Layout Matters
- VC++ CDialog用法的一些总结(转载)
- 阴影贴图
- [.NET]ADO.NET调用存储过程
- HDU 1257 最少拦截系统 (动态规划)
- Code Reviews
- Erlang TCP Socket
- WIFI基本知识整理
- 新地址
- 如何调用存储过程,有返回值的,有参数的,存储过程中调用存储过程
- 《Java Web设计模式之道》
- A2、减计数循环要比增计数循环更好。
- Ubuntu12 下安装Tomcat7
- 通过源码学算法--AdaBoost: CART插播