Skip to main content
CleanCodeMastery

Code Smells

Warning signs in code — learn to spot them early.

22 lessons · follow them in order, or jump to what you need.

beginner

Long Method: When One Function Tries to Do Everything

Learn the Long Method code smell with simple stories, TypeScript and C# examples, and step-by-step refactoring using Extract Method. Beginner friendly guide.

25 mincode smells · long method
beginner

Large Class: The School Bag That Carries Everything

Understand the Large Class code smell — why god classes grow, how to spot low cohesion, and how Extract Class splits them into small, focused classes.

23 mincode smells · large class
beginner

Primitive Obsession: When Everything Is Just a String or a Number

Primitive Obsession explained simply — why plain strings and numbers hide bugs, and how value objects like Money and Address make code safe and clear.

23 mincode smells · primitive obsession
beginner

Long Parameter List: The Chai Order That Took Ten Instructions

Long Parameter List code smell made simple — why methods with too many arguments cause bugs, and how parameter objects make calls short, clear, and safe.

21 mincode smells · long parameter list
beginner

Data Clumps: The Friends Who Always Travel Together

Data Clumps code smell for beginners — learn to spot groups of values that always travel together and bundle them into one class, like a student ID card.

22 mincode smells · data clumps
beginner

Switch Statements: The Receptionist With the Giant Rulebook

Learn the Switch Statements code smell with a school receptionist story, duplicated switch examples in TypeScript and C#, and the polymorphism cure.

27 mincode smells · oo abusers
beginner

Temporary Field: The Cricket Kit That Lives in the School Bag

Learn the Temporary Field code smell with a school bag story, see null-filled fields in TypeScript and C#, and fix them with Extract Class step by step.

25 mincode smells · oo abusers
beginner

Refused Bequest: The Child Who Refused the Sweet Shop Recipes

Learn the Refused Bequest code smell with a family sweet shop story, Liskov violations in TypeScript and C#, and the delegation cure explained step by step.

24 mincode smells · oo abusers
beginner

Alternative Classes with Different Interfaces: Two Tiffin Services, Two Languages

Learn this code smell with a tiffin delivery story: two classes do the same job with different method names, so you cannot swap them. Fix it step by step.

25 mincode smells · oo abusers
beginner

Divergent Change: One Poor Clerk, Too Many Bosses

Learn the Divergent Change code smell with a school clerk story, simple definitions, TypeScript and C# examples, a clear comparison with Shotgun Surgery, and practice.

27 mindivergent change · code smells
beginner

Shotgun Surgery: One Small Change, Ten Offices to Visit

Learn the Shotgun Surgery code smell with an address-change story, simple definitions, TypeScript and C# examples, a clear comparison with Divergent Change, and practice.

27 minshotgun surgery · code smells
beginner

Parallel Inheritance Hierarchies: Every Sweet Needs Its Shadow Box

Learn the Parallel Inheritance Hierarchies code smell with a sweet-shop story, mirrored class trees explained simply, TypeScript and C# examples, fixes, and practice.

27 minparallel inheritance hierarchies · code smells
beginner

Comments Smell: When Sticky Notes Hide a Messy Cupboard

Learn why too many comments can be a code smell. Understand good WHY comments vs bad WHAT comments with a sticky-note cupboard story and easy examples.

23 mincode-smells · dispensables
beginner

Duplicate Code: Writing the Same Address on 50 Wedding Cards

Learn the Duplicate Code smell with a wedding card story. Understand DRY, the Rule of Three, and how Extract Method removes dangerous copy-paste code.

20 mincode-smells · dispensables
beginner

Lazy Class: The Watchman Whose Only Job Is Pressing One Lift Button

Learn the Lazy Class code smell with a society watchman story. Find classes that do too little to deserve existing, and cure them with Inline Class.

20 mincode-smells · dispensables
beginner

Data Class: The Register With No Rules — Anyone Can Scribble Anything

Learn the Data Class smell with a society register story. See why data without behavior breaks encapsulation, and when DTOs and records are perfectly fine.

21 mincode-smells · dispensables
beginner

Dead Code: Old Furniture Blocking the Storeroom 'Just in Case'

Learn the Dead Code smell with a storeroom full of unused furniture. See why unreachable code costs real money, with the Knight Capital story and easy fixes.

20 mincode-smells · dispensables
beginner

Speculative Generality: Plumbing for a Swimming Pool You May Never Build

Learn the Speculative Generality smell with a house-building story. Understand YAGNI, why guessing future needs backfires, and how to collapse unused abstractions.

21 mincode-smells · dispensables
beginner

Feature Envy: The Method That Sits in Someone Else's Class All Day

Learn the Feature Envy code smell with a simple school story. When a method keeps using another class's data more than its own, it probably belongs in that other class. Cure it with Move Method.

26 mincode-smells · couplers
beginner

Inappropriate Intimacy: Two Classes That Walk Into Each Other's Kitchens

Learn the Inappropriate Intimacy code smell with a story of two neighbours who rearrange each other's kitchens. When two classes poke each other's private parts, neither can change alone. Learn the Law of Demeter and the refactorings that restore privacy.

25 mincode-smells · couplers
beginner

Message Chains: Asking a Friend, Who Asks a Cousin, Who Asks an Uncle

Learn the Message Chains code smell with a story about finding out if bread is available — through four people. When code reads a.getB().getC().getD(), the caller is coupled to a whole path. Learn the Law of Demeter and cure chains with Hide Delegate.

24 mincode-smells · couplers
beginner

Middle Man: The Helper Who Only Forwards Your Message to the Principal

Learn the Middle Man code smell with a story of a school helper who only carries messages without adding anything. When a class merely forwards every call, remove it — but learn why Proxy, Facade, and Adapter are middle men ON PURPOSE.

24 mincode-smells · couplers