Skip to main content
Clean Code 80 XP · 8 min

Heuristics Catalog Overview

A curated catalog of code smells and refactoring heuristics drawn from Clean Code chapter 17.

Showing
Ad (728×90)

Comments (C1–C5)

C1: Inappropriate Information — don't store metadata in comments. C2: Obsolete Comment — delete comments that no longer apply. C3: Redundant Comment — a comment that says the same as the code. C4: Poorly Written — if you must comment, write it well. C5: Commented-out Code — delete it.

General (G1–G6)

G1: Multiple Languages — one language per source file. G2: Obvious Behaviour Not Implemented — implement what the caller expects. G3: Incorrect Boundary Behaviour — test edge cases. G4: Overridden Safeties — never disable tests or assertions. G5: Duplication — every DRY violation is an opportunity to abstract. G6: Code at Wrong Level of Abstraction — keep high-level and low-level details separate.

Code Challenge

Identify which heuristics G1–G6 are violated, then see the fixes.

Key takeaway

Code smells are symptoms. Heuristics name them so you can reason about them, discuss them with your team, and track how often you encounter each.

Done with this lesson?

Mark it complete to earn XP and track your progress.