It's easier to explain price once, than to apologize for quality forever.

Zig Ziglar

The proverb: prevention is better than cure, is also applicable to software development. Often, the cost required to fix a problem faced by an end-user is relatively high compared to how much it would have cost to nip the defect in the bud. But just pouring in dollars to make the product bug-free is not the solution. At some point, the cost of prevention will outweigh its benefit. It is, therefore, vital to understand the cost of quality so that we can make informed decisions about whether to spend more dollars or not in improving quality.

Cost of quality is the sum of costs incurred on the prevention of defects and costs incurred due to failures.

Cost of quality = Cost of good quality + Cost of poor quality.

The Cost of Good Quality (CoGQ)

The cost incurred on the prevention of defects is called the cost of good quality. Its components are:

Prevention Costs: These are costs incurred from activities intended to keep defects to a minimum. Activities such as:

  • Writing good product specifications
  • Adherence to standards
  • Writing unit and integration tests
  • Code reviews
  • Code analysis tools
  • Quality training for developers

Appraisal Costs: These are costs incurred on testing activities to maintain adequate software quality levels. They include:

  • Quality planning
  • Writing test cases
  • Executing test cases
  • Test management and automation tools
  • Quality training for testers

The Cost of Poor Quality (CoPQ)

The cost incurred due to defects found in internal testing and bugs found in released software is called the cost of poor quality. Its components are:

Internal Failure Costs: These are costs associated with bugs found before the software is released to the customer. They include:

  • Development cost required to fix defects
  • Re-testing cost

External Failure Costs: These are costs related to bugs found after the software is released to the end-users. They include:

  • Development cost needed to correct defects
  • Re-testing cost
  • Warranty costs
  • Marketing costs to repair brand image
  • Lost customers cost (e.g., failure to renew their subscription)
  • Legal costs

Optimizing the Cost of Quality

A company aims to reduce the overall cost of quality.

Let's look at a typical graph of costs of quality.

We can observe that, as expected, meager prevention costs lead to higher failure costs. This is because low prevention costs implies that the product has not been tested adequately which in turn means more bugs for end-users. As the prevention costs increase, which signifies more testing, the failure costs decrease as fewer bugs are expected. But beyond a point, the cost of prevention exceeds the cost of failure. This point, where the cost of quality is minimum, is the company's optimal software quality level.