Heuristics Catalog Overview
A curated catalog of code smells and refactoring heuristics drawn from Clean Code chapter 17.
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.
🔧 Some exercises may still have errors. If something seems wrong, use the Feedback button (bottom-right of the page) to report it — it helps us fix it fast.
Hint: Heuristics are patterns, not rules. Apply judgment: know when a 'smell' is fine and when it's a warning sign.
✗ Your version