Smell Identification Clinic
Retrieval Prompts
- List at least 10 smells from Fowler's catalog from memory.
- Pair each smell with its canonical refactoring move.
- State the difference between Divergent Change and Shotgun Surgery.
- State the difference between a Long Method and a long, cohesive pure calculation.
- Explain why Speculative Generality is the counterweight to Replace Conditional with Polymorphism.
Compare and Distinguish
Separate these pairs:
- Divergent Change vs Shotgun Surgery
- Feature Envy vs Data Clump (sometimes the same move fixes both)
- Primitive Obsession vs genuine use of primitives for primitive data
- Repeated Switch vs a single switch in a central dispatcher
- Speculative Generality vs justified abstraction with two existing variants
Common Mistake Check
For each diagnosis, identify the error:
- "This method is 80 lines, so it is a Long Method." (What's missing?)
- "This class has 15 public methods, so it violates SRP." (When is that fine?)
- "We use
switchhere, so we should replace it with polymorphism." (What evidence is missing?) - "The interface has four methods; three clients use all four, one uses only one. That is an ISP violation." (Is it?)
- "Every new
Paymentsubclass needs a matchingPaymentValidatorsubclass. That's Parallel Hierarchies, so let's collapse both." (What should you check first?)
Mini Application
Three exercises, all required.
Exercise 1: Smell hunt on a real file
Pick any real file over 150 lines (ideally from an unfamiliar repo). Do all of:
- List every smell you find, with a short quote of the evidence.
- Rank them by pain-of-next-change (which one will bite you first?).
- Pair each smell with a refactoring move.
- Choose the top three to fix and justify the ordering.
Exercise 2: Change-based smells
Pick a recent feature branch. Do all of:
- List every file the branch touched.
- Classify the change pattern: concentrated, scattered, or mirrored (parallel).
- If scattered, where should the "home" have been?
- If concentrated, what smaller classes would have kept change local?
Exercise 3: Premature abstraction sweep
Scan a codebase you know for interfaces with exactly one implementation. Do all of:
- List each one.
- For each, answer: is there a second real variant today or in the next sprint?
- Mark
keep,inline, ordecide laterwith a reason. - Propose the inline refactor for any that have no justification.
Evidence Check
This page is complete only if you have:
- a ranked smell list with concrete evidence quotes
- a change-pattern classification for at least one real branch
- at least one speculative-abstraction decision with a written justification