BloatersCritical

God Class: What It Costs and How to Fix It

A class that knows too much and does too much, concentrating responsibilities that should be distributed.

Model cost, team of 8$17K-$61K/yr
Severity
5/5
CategoryBloaters
Detection4 tools

What It Is

A God Class (also called Large Class or Blob) is a class that has accumulated so many fields, methods, and responsibilities that it becomes the gravitational centre of the codebase. Everything depends on it, everyone modifies it, and nobody fully understands it. God Classes typically start as reasonable domain objects that grow incrementally over months or years. Each addition seems small, but the cumulative effect creates a class that violates the Single Responsibility Principle so thoroughly that it becomes a bottleneck for the entire team.

Threshold: Classes above 500 lines deserve scrutiny. Classes above 1,000 lines are almost certainly god classes. The most reliable indicator is the number of reasons to change: if a class changes for 3+ distinct business reasons, it is a god class.

Why It Costs Money

1

Merge conflicts become more likely. When developers working on unrelated features all have to edit the same large class, their changes collide in the same file. Every hour spent resolving those conflicts is an hour not spent on the feature.

2

Onboarding slows down. New developers take longer to become productive in modules dominated by god classes, because they must understand the entire class before they can safely change any part of it.

3

Bug clustering is severe. Defects concentrate heavily in a small fraction of the codebase: CodeScene's hotspot research reports cases where roughly 1.2% of the code accounts for around 45% of the bugs teams detect and fix. God Classes, being large and modified constantly, are almost always among those hotspots, making them a leading source of production incidents.

Specific Cost Mechanisms

  • ●Merge conflict resolution: whenever two features in flight both have to change the god class
  • ●Onboarding delay: additional ramp time per new hire, at fully-loaded cost (our model assumes 1 to 3 weeks)
  • ●Bug investigation: god class bugs are slow to diagnose because the class has so many interacting state variables

Estimated Annual Cost

Cost of one instance a year by team size, from our model at $180K fully-loaded cost per engineer. Low and high use the bottom and top of the Critical inputs; mid is halfway. See full methodology.

Team SizeLowMidHigh
3 devs$7K$16K$25K
5 devs$11K$25K$40K
8 devs$17K$39K$61K
10 devs$21K$48K$75K
20 devs$41K$94K$146K

These are model outputs, not measurements. Every input is on the cost model page, and the same model produces the figures on the 22 smells page. Put in your own team and cost in the smell profile calculator.

How to Detect It

Specific rules and thresholds for automated detection. See full tool comparison.

SonarQube
squid:S1200 / squid:S2972

Class coupling > 20, class lines > 750

CodeClimate
file-lines / method-count

File lines > 250, method count > 20

ESLint
max-lines / max-classes-per-file

Set file max to 300 lines for JS/TS

PMD
GodClass / ExcessiveClassLength

Detects classes with high WMC (Weighted Methods per Class)

Refactoring Patterns

Proven techniques to eliminate this smell. See all refactoring patterns.

Extract Class

Groups of fields and methods that form a coherent subset of the class responsibilities

Effort (our estimate): 4-16 hours depending on coupling
Impact: Fewer developers editing the same file for unrelated reasons

Extract Subclass

Some instances use only a subset of the class features

Effort (our estimate): 2-8 hours
Impact: Reduces class size and enables targeted testing

Replace Data Value with Object

Primitive fields that carry behaviour elsewhere in the god class

Effort (our estimate): 1-4 hours per data cluster
Impact: Moves validation and behaviour next to the data it belongs to

Related Smells

Updated November 2026