Skip to main content

Module 1: OOD Foundations & Code Smells: Mistake Clinic

This clinic turns wrong moves into reusable judgment. Use it after each practice page and again before the quiz or checkpoint.


Module-Specific Mistake Radar

Start with these traps. Replace or extend them with real mistakes from your own work.

Mistake to look forWhere it shows upSymptomRepair evidence
Finishing Cohesion, Coupling, and SOLID Lab with only a final answerCohesion, Coupling, and SOLID LabThe work has no failed case, trace, test, proof gap, or design stress point.Add the smallest broken example and show the repair that changes the result.
Finishing Naming and Function Refactor Workshop with only a final answerNaming and Function Refactor WorkshopThe work has no failed case, trace, test, proof gap, or design stress point.Add the smallest broken example and show the repair that changes the result.
Finishing Smell Identification Clinic with only a final answerSmell Identification ClinicThe work has no failed case, trace, test, proof gap, or design stress point.Add the smallest broken example and show the repair that changes the result.
Finishing Code Katas with only a final answerCode KatasThe work has no failed case, trace, test, proof gap, or design stress point.Add the smallest broken example and show the repair that changes the result.
Treating Cohesion: A Class Does One Thing Well as vocabulary instead of a toolCohesion: A Class Does One Thing WellThe explanation names the concept but cannot decide between two cases.Write one example, one non-example, and the rule that separates them.
Treating Coupling: Minimize What a Module Needs to Know as vocabulary instead of a toolCoupling: Minimize What a Module Needs to KnowThe explanation names the concept but cannot decide between two cases.Write one example, one non-example, and the rule that separates them.

Practice Mistake Checks

Pull any miss from these checks into your mistake log.

Cohesion, Coupling, and SOLID Lab

Source: practice/01-cohesion-coupling-and-solid-lab.md

For each statement, identify the design error:

  1. "I split the class into two files, so the cohesion is higher now."
  2. "This getter returns the internal ArrayList, but the field is private, so the class is encapsulated."
  3. "Square extends Rectangle compiles and the tests pass, so Liskov is satisfied."
  4. "I added an interface with one implementation so we can swap it later."
  5. "This method used to be 150 lines; I split it into 15 ten-line methods named step1 through step15."

Naming and Function Refactor Workshop

Source: practice/02-naming-and-function-refactor-workshop.md

For each snippet or claim, identify the naming or decomposition error:

  1. fun handle(x: List<Any>): List<Any>
  2. // sorts customers by name above a method that sorts by creation date.
  3. A 20-line method extracted as step1, step2, step3, each called once.
  4. A boolean parameter named flag passed to process(data, flag).
  5. A class named UserDataManager with methods getUserList(), processUserData(), handleUserInfo().

Smell Identification Clinic

Source: practice/03-smell-identification-clinic.md

For each diagnosis, identify the error:

  1. "This method is 80 lines, so it is a Long Method." (What's missing?)
  2. "This class has 15 public methods, so it violates SRP." (When is that fine?)
  3. "We use switch here, so we should replace it with polymorphism." (What evidence is missing?)
  4. "The interface has four methods; three clients use all four, one uses only one. That is an ISP violation." (Is it?)
  5. "Every new Payment subclass needs a matching PaymentValidator subclass. That's Parallel Hierarchies, so let's collapse both." (What should you check first?)

Repair Protocol

For each real mistake:

  1. Reproduce the failure on the smallest example, trace, proof, query, command, or design sketch.
  2. Name the hidden assumption.
  3. Repair the artifact.
  4. Save evidence that changed: failing then passing test, corrected proof step, revised diagram, safer command, benchmark, or review note.
  5. Add one retrieval card beginning with Check... before... or Do not use... when....

Mistake Log

DateMistakeSymptomRoot causeRepair evidenceRetrieval card
StarterPick one radar row aboveExplain how it would fail in this moduleName the assumptionAdd a counterexample or corrected artifactWrite the card before closing the page

Completion Standard

  • At least five real mistakes are logged.
  • At least two mistakes include a counterexample or failing test.
  • At least one mistake connects to an older semester skill.
  • At least one correction changes code, a proof, a diagram, a command transcript, a query, or a design decision.