Cost models illustrative. Numbers from academic and industry research; methodology documented. Not investment or engineering advice; your mileage will vary.

codesmellcost.com · 2026 edition · last verified May 2026

Code smells are what engineering leaders inherit. The dollar cost is what the CFO inherits next.

This site translates Martin Fowler's catalog of code smells into dollar figures an executive committee can act on. Every smell gets a cost badge, a detection recipe, and a refactoring pattern. The calculator below is the full math, open and reproducible, with a CSV export.

Companion site for the product layer: featurebloat.com , where the same argument plays out from the product manager's side of the table.

§ 01
The Calculator

Your annual tech-debt cost

$242,875 – $402,300

PR review drag

$34,020 – $63,180

Incident cost

$6,978 – $25,920

Rework drag

$172,800 – $259,200

Onboarding drag

$29,077 – $54,000

Full model with methodology →
§ 02
What a Code Smell Is

Martin Fowler's definition, from Refactoring (2nd ed., p. 75): “a surface indication that usually corresponds to a deeper problem in the system.” The key word is indication. A smell is not a bug. Code with smells runs. It compiles, it deploys, it passes the regression suite.

But smells are the preconditions for bugs. Rahman 2025's meta-study across 28 primary studies found God Class correlated with defect density at ρ=0.38, Feature Envy at ρ=0.31, Duplicate Code at ρ=0.27. These are not trivial effect sizes. They mean that a smell-dense module is statistically nearly four times more likely to have a reported defect than a smell-free one.

The catalog Fowler published in 1999 and expanded in the 2018 second edition names 22 distinct smells across five categories: bloaters, couplers, dispensables, change preventers, and object-orientation abusers. This site attaches a dollar figure to each one.

§ 03
The Twenty-Two Smells, at a Glance
God Class$42K–$180K/yr

One class doing everything. Merge conflicts, review drag, incident risk.

Long Method$22K–$80K/yr

Cognitive complexity scales with nesting. Reviews slow, tests brittle.

Duplicate Code$18K–$95K/yr

Fix in one place, forget the other. Bugs propagate silently.

Feature Envy$12K–$55K/yr

A method that reads another class's data more than its own.

Long Parameter List$8K–$35K/yr

More than three or four parameters. Callers must remember the order.

Divergent Change$15K–$60K/yr

One class changed for multiple unrelated reasons. Violates SRP.

Shotgun Surgery$20K–$75K/yr

One change requires edits across many classes. Ripple-effect fragility.

Data Clumps$6K–$25K/yr

Three fields that always appear together. Extract into an object.

Primitive Obsession$8K–$30K/yr

Using raw strings and ints where a class would carry meaning and validation.

Switch Statements$10K–$40K/yr

Long switch blocks that are repeated across the system.

Parallel Inheritance$15K–$55K/yr

Adding a subclass in one hierarchy forces a subclass in another.

Lazy Class$3K–$12K/yr

A class that does so little it should be collapsed into its caller.

Speculative Generality$10K–$40K/yr

Hooks for future requirements that never materialised. Dead weight.

Temporary Field$5K–$18K/yr

An instance variable only set in certain execution paths. Confuses readers.

Message Chains$6K–$22K/yr

a.getB().getC().getD(). Tight coupling across multiple hops.

Middle Man$4K–$15K/yr

A class that delegates everything and adds no value.

Inappropriate Intimacy$12K–$45K/yr

Two classes that poke into each other's private parts.

Alternative Classes$8K–$28K/yr

Two classes with different names doing the same job.

Data Class$4K–$15K/yr

A class with only fields and getters/setters. Behaviour lives elsewhere.

Refused Bequest$8K–$30K/yr

A subclass that ignores what it inherits. The hierarchy is wrong.

Comments as Apology$3K–$10K/yr

A comment explaining why the code is bad. Fix the code instead.

Dead Code$10K–$35K/yr

Code that is never executed. The Knight Capital liability.

Cost estimates per year for a team of 8. Ranges reflect low-severity (single violation) to high-severity (multiple violations, no tests). Read the full catalog with methodology →

§ 04
Why This Costs So Much

01

PR review drag

2.3x slower reviews in smell-dense modules

CodeScene Code Health research, 2023

Cognitive complexity scales with nesting and branching, not raw line count. A 40-line method with three nested conditions takes longer to review than a 120-line flat switch. Reviewers hit the cognitive ceiling researchers estimate at 60 minutes and 400 LOC.

Review time research

02

Incident cost

2-3x defect rate in smell-dense modules

Bird et al., FSE 2011; Bavota et al., ICSE 2015

Smelly modules correlate with significantly higher defect density across multiple large-scale studies. Bird et al. found fragmented ownership doubles or triples defect rates. Bavota 2015 found smells emerge under schedule pressure and immediately increase fault-proneness.

Defect density research

03

Story-point drag

10-25% of sprint capacity lost to rework

DORA State of DevOps 2024

DORA research consistently finds that low-performing engineering teams spend 10-25% of sprint capacity on unplanned rework and fixes. Smell density is the most tractable single predictor of rework rate.

The ROI model

04

Onboarding cost

6-12 weeks ramp on smell-dense vs 2-4 weeks on clean

Pluralsight State of Developer Onboarding 2024

New hires ramp 3-4x slower on smell-dense codebases. Each extra week of ramp at $3,000/week is a direct cost. Multiply by hiring volume and turnover and the annual onboarding drag easily exceeds the refactoring cost.

Onboarding drag math
§ 05
Where to Go Next

The Calculator

Full model: team size x PR hours x incidents x rework. CSV export. Deep-link.

Refactoring ROI

The CFO-facing memo. NPV worksheet. The pitch that gets a yes.

The 22 Smells

Full catalog with cost badges, refactoring patterns, and detection recipes.

Case Studies

Knight Capital, Therac-25, Stripe, Google, Spotify. Named numbers.

§ 06
Digital Signet Consulting

Need an outside eye on your codebase?

Digital Signet runs two-week code-debt audits. We map the smells, attach the dollar figures, and deliver the memo your CFO will sign. Fixed-scope engagement, senior engineers, honest report whether the answer is “refactor now” or “this is defensible.”

Email Oliver →
§ 07
Frequently Asked Questions
What is a code smell?+

A code smell is a surface-level indicator in source code that usually corresponds to a deeper structural problem. Fowler's definition: 'a surface indication that usually corresponds to a deeper problem in the system.' Smells are not bugs - code with smells runs - but they increase the probability of future bugs, slow reviews, and make the codebase harder to change.

What does a code smell actually cost?+

The cost has four components: PR review drag (smell-dense code takes longer to review - cognitive complexity scales with nesting, not line count), incident cost (smelly modules correlate with 1.5-3x higher defect density according to Bavota 2015 and Rahman 2025), story-point rework drag (10-25% of sprint capacity lost to rework in smell-dense codebases, per DORA research), and onboarding cost (new hires ramp 3-4x slower on smell-dense codebases). For a team of eight engineers, one concentrated God Class costs $42,000-$180,000 per year.

Do code smells cause bugs?+

Correlation is strong and robust. Bavota et al. (ICSE 2015) found smells correlate with fault-proneness across multiple Java systems. Rahman 2025 meta-study found God Class at rho=0.38, Feature Envy at rho=0.31, Duplicate Code at rho=0.27. Bird et al. (FSE 2011) showed modules with fragmented ownership have 2-3x the defect rate. The caveats: correlation is not causation, some smells (Comments, Data Class) show weak correlation, and open-source study selection bias applies.

Is Clean Code still relevant in 2026?+

Partly. Robert C. Martin's Clean Code remains essential on naming, function-length discipline, and the Single Responsibility Principle. Where it is contested: some of its function-size guidance produces over-decomposed code that is harder to understand than a longer, well-commented method. John Ousterhout's A Philosophy of Software Design (2018) is the most rigorous counterpoint: deep modules beat small scattered ones. Read both; the field legitimately disagrees.

How do I sell refactoring to management?+

Three framings land with finance: (1) Risk reduction - probability-weighted incident cost. If you have a 15% annual chance of a million-dollar incident, expected value is $150k/yr. A refactor that drops probability to 5% is worth $100k/yr in expected-value reduction. (2) Velocity reclaim - DORA data shows elite performers ship 10x more frequently; moving one quartile is 1-3% of engineering capacity. (3) Retention - engineer attrition attributed to code pain, replacement cost 1.5x salary. See the full memo template on /refactoring-roi.

Updated May 2026