Quality models, metrics and quality control
Overview of quality models (McCall, Boehm, ISO/IEC 25010), common software quality metrics (defect density, DRE, MTTF, MTTR, availability) and quality-control tools (control charts, acceptance sampling) with definitions, formulas, derivations and worked examples for exam preparation.
Drafted with Aria, reviewed by the AiCanCode.org team · Updated . How we write and check our notes. Spotted an error? Use Give Feedback at the bottom of the page.
Why it matters
Two short sentences: Engineers use quality models to describe what "good" software means and to select measurable targets. Quality metrics and quality control give objective evidence that software meets those targets and help decide when to release or improve the process.
Key ideas
Start from first principles and plain definitions. Define each term before use.
Quality (software): the degree to which a software product meets stated and implied needs of users. This is assessed by observable attributes (functioning, performance, maintainability, etc.).
Quality model: a structured collection of quality characteristics and sub-characteristics used to evaluate software. A quality model defines what aspects of the product we measure.
McCall's quality factors (classic model): Correctness, Reliability, Efficiency, Integrity, Usability, Maintainability, Testability, Portability, etc. For an exam draw a box labelled "Software" and list factors around it with arrows indicating they are aspects to measure.
Boehm's model: organizes quality into high-level characteristics (utility, reliability, efficiency, human engineering, testability, understandability, etc.). Mention as an extension linking user needs to lower-level factors.
ISO/IEC 25010 (successor to ISO/IEC 9126): current international model. Its main characteristics: Functional suitability, Performance efficiency, Compatibility, Usability, Reliability, Security, Maintainability, Portability. Each characteristic has sub-characteristics (for example, Reliability includes maturity, availability, fault tolerance, recoverability). Assume exam expects you to name and briefly explain these.
Quality metric: a quantifiable measure of a quality attribute. A metric has a clear definition, measurement unit, and interpretation rule. Examples: code coverage (%) for test thoroughness, cyclomatic complexity (unitless) for maintainability/testability, response time (ms) and throughput (req/s) for performance efficiency, and defect leakage (%) post-release.
Defect: any fault/bug in the software that can cause incorrect behaviour. Define defect density as defects per thousand lines of code (defects/KLOC) or per function point. Define KLOC: thousand lines of code. Define Function Point (FP): a functional size unit based on user-visible functionality (e.g., per IFPUG); used as an alternative size denominator to LOC.
Defect Removal Efficiency (DRE): proportion of defects removed before delivery. Exact statement: DRE = (defects found and fixed before release) / (total defects = defects found before release + defects found after release). DRE is often expressed as a percentage. State assumptions: counting of defects is consistent and duplicates are merged.
Reliability metrics: include MTTF (Mean Time To Failure), MTTR (Mean Time To Repair), MTBF (Mean Time Between Failures) and availability. Define each:
- MTTF: average operating (up) time until a failure occurs; for non-repairable items this is time to first failure, and for repairable systems it is the mean up-time between failures (exclude downtime).
- MTTR: average time to restore service after a failure (includes diagnosis, repair and testing until return to operation).
- MTBF: for repairable systems MTBF = MTTF + MTTR (some texts approximate MTBF ≈ MTTF when MTTR ≪ MTTF); define carefully.
- Availability: probability that the system is operational at a given time. For alternating up/down cycles in steady state, Availability = MTTF / (MTTF + MTTR).
- Assumptions: For formulas that use an exponential failure distribution, assume constant failure rate (memoryless). Where that assumption is not true, these formulae are approximations.
Quality control: operational techniques and activities used to fulfill quality requirements. Contrast with Quality assurance: QA is process-oriented (prevent defects); QC is product-oriented (detect defects). (Other topics cover QA more deeply.)
Control charts (Shewhart charts): plot of sample statistics (e.g., sample mean or range) over time with a centre line (process mean) and upper and lower control limits (UCL, LCL). Exact statement: if all points inside control limits and no non-random patterns, process is in statistical control. To draw: x-axis = sample number/time, y-axis = measured statistic; draw centre line (mean), UCL and LCL as horizontal lines; plot points and look for trends or runs.
Acceptance sampling: inspect a sample from a lot and accept/reject the entire lot based on number of defects found and a predefined Acceptance Quality Level (AQL). State assumptions: sampling is random and the sample size and acceptance number are chosen according to the required producer/buyer risk.
Pareto principle (80/20): not a mathematical law but an empirical rule used in quality: roughly 80% of defects come from 20% of modules. Use for prioritising defect fixes; label as heuristic.
Assumptions to state in exam answers: measurements are consistent, defects are classified consistently, failure arrivals follow assumed distribution (if using exponential), sample sizes large enough for control-chart statistics.
If asked for diagrams: draw a simple box-and-arrow mapping from quality model (left) to measurable metrics (right). For a control chart draw a time series with central line and UCL/LCL and annotate one point outside UCL.
Formulas
Defect density = defects found (in the period of interest) / (size in KLOC) — defects per KLOC; where "size in KLOC" = lines of code / 1000. Unit: defects/KLOC. Always state the period (e.g., during system testing, pre-release, or lifetime). Applies when measuring code quality per LOC.
DRE = defects_removed_before_release / (defects_removed_before_release + defects_found_after_release) — dimensionless (fraction or %). Applies when defects can be reliably counted before and after release.
MTTF = total operating (up) time / number of failures — time units (s, h). For non-repairable items, this is the mean time to first failure (across a population). For repairable systems, it is the mean up-time between failures (use up-time only; exclude downtime).
MTTR = total repair time / number of repairs — time units (s, h). Applies when repair times are recorded consistently.
MTBF = MTTF + MTTR — time units. Applies for repairable systems when MTBF is defined as time between successive failures.
Availability (steady-state) = MTTF / (MTTF + MTTR) — dimensionless (fraction or %). Assumes alternating up/down cycles and steady-state behaviour.
Failure rate λ (exponential) = 1 / MTTF — unit 1/time (s^-1, h^-1). Applies when failures are Poisson/exponential. Reliability function (exponential): R(t) = exp(−λ t); CDF: F(t) = 1 − R(t).
When using control charts (mean chart for samples of size n): UCL = μ + z * (σ / sqrt(n)), LCL = μ - z * (σ / sqrt(n)) where μ is process mean, σ is process standard deviation, z is chosen z-score (≈3 for 3-sigma limits). Units same as measured variable. Applies when sample means are approximately normally distributed (Central Limit Theorem) and σ is known; if σ is unknown, use R-bar or s-bar methods with appropriate constants (A2, D3, D4) to estimate limits.
Worked examples
Example 1 — Defect density and DRE (numerical) Given: A project has 50,000 lines of code (LOC). During testing before release 120 defects were found and fixed. After release in the field, users reported 30 defects. Step 1: size in KLOC = 50,000 / 1000 = 50 KLOC. Step 2: Defect density = total defects found (before release) / KLOC = 120 / 50 = 2.4 defects/KLOC. Answer: 2.4 defects/KLOC. Step 3: DRE = defects_removed_before_release / (defects_removed_before_release + defects_found_after_release) = 120 / (120 + 30) = 120 / 150 = 0.8 = 80%. Answer: DRE = 80%. Units: defects/KLOC and percent.
Example 2 — Reliability and availability Given: Over a long observation, a server experiences on average 2 failures in 10,000 hours of operation. Each repair takes on average 5 hours. Step 1: number of failures = 2; total operating time = 10,000 h. MTTF = total operating time / number of failures = 10,000 / 2 = 5,000 h. MTTF = 5,000 h. Step 2: MTTR = average repair time = 5 h (given). MTTR = 5 h. Step 3: Availability = MTTF / (MTTF + MTTR) = 5,000 / (5,000 + 5) = 5,000 / 5,005 ≈ 0.999001. Availability ≈ 99.9001%.
Example 3 — Control chart decision (small algorithmic trace) Given: sample means (n=5) measured for 8 successive samples: 10.1, 9.8, 10.2, 10.5, 9.7, 10.0, 10.3, 12.0. Historical σ = 0.5, μ = 10.0, use 3-sigma limits. Step 1: Standard error = σ / sqrt(n) = 0.5 / sqrt(5) ≈ 0.2236. Step 2: UCL = μ + 3 * SE ≈ 10 + 3*0.2236 = 10 + 0.6708 = 10.6708. Step 3: LCL = 10 - 0.6708 = 9.3292. Step 4: Compare points: the last point 12.0 > UCL. Conclusion: process out of control at sample 8. Explain: investigate assignable cause. Answer: out-of-control due to sample 8.
Common mistakes
- Using DRE formula but omitting post-release defects (underestimates total defects).
- Assuming exponential failure model without stating the constant failure-rate assumption.
- In control charts: using 3-sigma limits but applying them to single-item measurements (use appropriate chart type: X¯ for means, R or S for ranges/standard deviations, p-chart for proportions).
- Treating MTBF as MTTF incorrectly for non-repairable systems — state repairability assumption.
For your exam
Types of questions you will see: definitions (name and explain models/metrics), short notes (compare McCall vs ISO 25010), derivations (derive DRE formula and relate to defect counts), numericals (compute defect density, DRE, MTTF/MTTR, availability), diagrams (draw a control chart and mark out-of-control points), and reasoning/strategy (choose metrics for a project and justify).
What a full-marks answer includes:
- Clear definitions with bolded term names and units where applicable. State assumptions explicitly (e.g., constant failure rate, how defects counted).
- For models: name, list main characteristics and one short explanation of each characteristic chosen by the examiner.
- For metrics: formula, units, when to use it, and a small worked example or interpretation.
- For control-chart questions: draw (or describe) the chart, calculate centre line and control limits, list rule(s) used to detect non-random behaviour, and give recommended actions.
- For design/strategy questions: justify metric choice (ease of measurement, sensitivity, cost) and show understanding of how metrics influence decisions (release, resource allocation).
Quick check
- Define Defect Density and give its units.
- Write the formula for DRE and explain what it measures.
- If MTTF = 2,000 h and MTTR = 10 h, what is availability (in %)?
Answers: 1) Defect Density = defects per KLOC (defects/KLOC). 2) DRE = defects_removed_before_release / (defects_removed_before_release + defects_found_after_release); it measures the fraction of defects caught before release. 3) Availability = 2000 / (2000 + 10) = 2000/2010 ≈ 0.99502 → 99.502%.
Finished this topic? Mark it so your progress, study plan and readiness keep up.
Stuck on something here?