用户操作
[发私信]  [加为好友] 
KerryZhu
订阅我的博客
XML聚合    FeedSky
订阅到鲜果
订阅到Google
订阅到抓虾
KerryZhu的公告
....产品的质量依赖于过程的质量,而过程的质量依赖于企业文化和管理
Locations of visitors to this page
文章分类
收藏
测试、过程和质量
测试
CSDN软件测试圈
卖烧烤的鱼博客
天行健,君子当自强不息
开源测试工具
探索中国软件测试之道
测试专业论坛
测试最佳实践
祖洪自动化维客系统
自动化测试资源(英文)
软件测试之家
故乡
家乡美-中国第一状元县
家乡美-徽州文化-荫余堂
徽州文化-建筑、版画、雕刻...
故园徽州
故园徽州圈
软件开发和管理
CSDN-质量圈(RSS)
Google 开发社区
InfoQ
微软社区
有效工作和管理
计算机电子书
同学友人
江湖一萍- 古徽州婺源人
博文视点 周筠
李笑来 -Pure Pleasure
文化名人的Blog
余秋雨
易中天
综合
MIT Open Courses
世界经理人
商业英才网-管理频道
畅享网
存档

翻译  代码评审的最佳实践 收藏

        有人否认code review(代码评审、复查) 对提高代码质量的作用,但是如何进行code review? 这里 确实存在一些方法和技巧。方法不当,会浪费大量时间、造成低效率;流程过紧,会大大降低生产力,流程过松,很难知道code review的效果,甚至有没有进行code review,都很难判断。

这里有11条代码复审的最佳实践:

  1. 一次检查少于200~400行代码
  2. 努力达到一个合适的检查速度:每小时少于300~500行代码
  3. 有足够的时间、以适当的速度、仔细地检查,但不宜超过60~90分钟
  4. 在复审前,代码作者应该对代码进行注释
  5. 建立量化的目标并获得相关的指标数据,从而不断改进流程
  6. 使用检查表(checklist)肯定能改进双方(作者和复审者)的结果
  7. 验证缺陷是否真正被修复
  8. 管理人员要营造良好的氛围(文化),使大家可以积极地对待缺陷的发现,发现足够多的缺陷,只关心问题是什么、怎样引起的,而不关心是谁写的代码
  9. 清楚度量工具("Big Brother")的作用——度量工具是双刃剑,要小心使用
  10. 自我约束:即使没有时间完成所有代码的检查,也应该尽可能去做,哪怕是一部分
  11. 轻量级的code review是高效率的、可行的,并能有效地发现缺陷
 

详细内容参见
[PDF] Best Practices for Peer Code Review  ( www.SmartBearSoftware.com)
Code Reviews http://dotnet.org.za/cjlotz/archive/2007/08/28/code-reviews.aspx

有一个评论,对大家也有帮助,如强调code review的目标、代码静态分析工具的使用等:

I think the first thing you need to figure out is what kind of errors are you expecting to find during inspections. It must exist a clear idea of the goal of the review and all participants should share this idea. If this is not defined you may have reviews wasting time in discussions about variable names, indentation, code comments, message descriptions, or any other topic.

In my company for example, we don't look for code conventions compliance, we use automated tools to ensure that. We run static analysis tool on our code before inspections, therefore we don't look for the type of errors that this tool can easily report. But we do look for compliance with the design: is the code implementing the defined design appropriately? Are all exception conditions handled following the design?

One useful thing that I did in the past to define our goal for code reviews is to read different code inspection checklists available online and identify the items that I considered useful for our reviews. Then, based on that list I agreed with the team the aspects that we should check in our code reviews. In that way we focused our effort and everyone was on the same page during the review.


另外参考文章:

 

发表于 @ 2007年10月08日 12:56:00 | 评论( loading... ) | 编辑| 举报| 收藏

旧一篇:如何有效又圆满地完成软件测试? | 新一篇:测试工具LoadRunner和OpenSTA比较分析

Csdn Blog version 3.1a
Copyright © KerryZhu