一般来说代码评审分为正式代码评审与轻量级代码评审俩种
Formal Code Review(正式代码评审)
Fagan inspection范根检查法:
RolesAuthor/Designer/Coder: 作者
Reader: paraphrases the document阅读者
Tester: reviews the document from a testing standpoint评审员
Moderator: responsible for the inspection session, functions as a coach协调人
Recorderrecord detects.(记录员)
Flow
Lightweight Code Review(轻量级代码评审)
几种常见的轻量级代码评审方式
Over-the-shoulder – One developer looks over the authors shoulder as the latter walks through the code.它由作者启动和主持
评审作者向评审者展示文档优点是启动快成本低缺点是容易被作者误导过程
Email pass-around – Source code management system emails code to reviewers automatically after checkin is made.优点自动化可以及时提供最新代码进行评审缺点是无法达到人工筛选的功效
Pair Programming – Two authors develop code together at the same workstation, such is common in Extreme Programming.源于XP作者与评审者平级可以帮助同伴间的学习和共享
Review Meeting – (定期组织review会议轮流有团队成员选出自己的评审作品需要系统化得预备总结和追踪优点可以提高团队整体技能和对产品的理解缺点是评审范围有限成本较高 )
Tool-assisted code review – Authors and reviewers use specialized tools designed for peer code review. 大量的
代码评审工具比较流行的checkstyle/findbugs/pmd
本文以下内容都是指针对轻量级代码评审进行进一步讨论