lect_04_qa_code_review
lect_04_qa_code_review
Lecture 04
Peter CY YAU
What is Quality?
• Quality assurance (QA) is the term used in both manufacturing and service
industries to describe the systematic efforts taken to ensure that the product(s)
delivered to customer(s) meet with the contractual and other agreed/agreement
upon performance, design, reliability, and maintainability expectations of that
customer.
• The core purpose of Quality Assurance is to prevent mistakes and defects in the
development and production of both
• manufactured products, such as automobiles and shoes, and
• delivered services, such as automotive repair and athletic shoe design.
• Assuring quality and therefore avoiding problems and delays when delivering
products or services to customers is what ISO 9000 defines as that
• "part of quality management focused on providing confidence that quality
requirements will be fulfilled".
• This defect prevention aspect of quality assurance differs from the defect detection
aspect of quality control.
• A code review checklist is a predetermined set of questions and rules your team
will follow during the code review process, giving you the benefit of a structured
approach to necessary quality checks before you approve code into the codebase.
• Readability: Are there any redundant comments in the code?
• Security: Does the code expose the system to a cyber attack?
• Test coverage: Is there a need to test more cases?
• Architecture: Does the code use encapsulation and modularization to achieve
separation of concerns?
• Reusability: Does the code use reusable components, functions, and services?
• You can’t correct someone’s code quality without measuring it. Objective metrics
help determine the efficiency of your reviews, analyze the impact of change on the
process, and predict the number of hours required to complete a project.
• Inspection rate: The speed at which your team reviews a specific amount of
code, calculated by dividing lines of code (LoC) by number of inspection hours.
If it takes a long time to review the code, there may be readability issues that
need to be addressed.
• Defect rate: The frequency with which you identify a defect, calculated by
dividing the defect count by hours spent on inspection. This metric helps
determine the effectiveness of your testing procedures; for example, if your
developers are slow to find defects, you may need better testing tools.
Prepared by Peter YAU Source: https://www.atlassian.com/blog/add-ons/code-review-best-practices 13
Introduce Code Review Metrics (Cont)
• Defect density: The number of defects you identify in a specific amount of code,
calculated by dividing the defect count by thousands of lines of code (kLOC).
Defect density helps identify which components are more prone to defects than
others, allowing you to allocate more resources toward the vulnerable
components. For example, if one of your web applications has significantly
more defects than others in the same project, you may need to assign more
experienced developers to work on it.
• When reviewing code, don’t simply suggest what needs to be fixed or improved
upon – explain why the developer should make that change.
• Subjective / Objective
• Norm (just accept it, ha~)
Teaching materials in this slide is derived, referenced and/or extracted from the following sources. We
try to make the acknowledgements and references as accurate as possible. Thank you very much.
• Internet Resources, such as Wikipedia, CodingBestPractices from codebasics, JavaPoint, smartbear,
github, Atlassian, etc.
• IEEE Library, IEEE Xplore
• COMPSCI4015 Professional Software Development (H), University of Glasgow (UoG), Dr. Tim Storer
• COMPSCI3005 - Software Engineering M3, UoG, Dr. Richard McCreadie
• Software Engineering (Publisher: Pearson), Ian Sommerville
• Engineering Software Products: An Introduction to Modern Software Engineering (Publisher:
Pearson), Ian Sommerville.
• Contents, and comments from Dr Cao Qi