Code Review

前陣子想了解一下 Code Review 的相關議題,除了向好朋友詢問相關的經驗之外,也搜尋網路上的文章說明和意見,以下將一些想法簡單做個歸納。

What’s Code Review:

  • 由其他開發人員來檢閱某個開發人員的程式碼
  • 重視逐行檢閱與評判
  • 旨在互助合作,並非尋找錯誤
  • 通常發生在程式碼整合階段
  • 開發人員需在自願性的程式碼檢閱情況下,較能有正面效益產生

Premise:

  • 開發人員應先行 Build Project 及執行 Unit Test,以確保基本問題掀被解決,使得 Code Review 能夠聚焦於提昇原始碼質量
  • Reviewer 應對原始碼結構與運作有基本了解
  • 最重要的是每個成員都需了解 Code Review 的目的與精神

Benefits:

  • 更易察覺臭蟲
  • 強制性要求 coding standard & style
  • 指導新進人員
  • Pair Programming

Check List:

  • Completeness

    • Functionality
    • Integration & Debug
    • Establish Database

  • Consistency

    • Logicality
    • Coding Style

  • Correctness

    • Coding Standard
    • Comment Clarity

  • Modifiability

    • 程式為一進一出
    • Easy to Modify the Constant Values

  • Predictability

    • Dead Lock
    • Infinite Loop
    • Good Grammar & Semantic of the Used Programming Language
    • Eliminating the Dependency of the Particular Function in Programming Language

  • Robustness

    • Runtime Error such as Cutoff Detection, Divide by Zero, and Access the Invalid Position of Array.

  • Structuredness
  • Traceability
  • Historical Record
  • Understandability
  • Verificability

    • Easy to Test

Tools for Code Review:

Another Opinion and Talk:

發佈留言