Why we do Code Review(為什麼進行),Types of Code Review(代碼評審的幾種類型),Formal Code Review(正式代碼評審),Lightweight Code Review(輕量級代碼評審),Options of Code Review(代碼評審的選擇),Practice of Code Review(代碼評審實踐),
Why we do Code Review(為什麼進行)
1、提高質量
2、及早發現潛在缺陷與BUG,降低事故成本。
3、促進團隊內部知識共享,提高團隊整體水平
4、評審過程對於評審人員來說,也是一種思路重構的過程。幫助更多的人理解系統。
Types of Code Review(代碼評審的幾種類型)
一般來說,代碼評審分為正式代碼評審與輕量級代碼評審兩種
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(協調人)
Recorder:record detects.(記錄員)
Flow
Lightweight Code Review(輕量級代碼評審)
幾種常見的輕量級代碼評審方式:
Over-the-shoulder – One developer looks over the author’s 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,作者與評審者平級,可以幫助同伴間的學習和共享)