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 for | Where it shows up | Symptom | Repair evidence |
|---|---|---|---|
| Finishing Cohesion, Coupling, and SOLID Lab with only a final answer | Cohesion, Coupling, and SOLID Lab | The 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 answer | Naming and Function Refactor Workshop | The 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 answer | Smell Identification Clinic | The 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 answer | Code Katas | The 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 tool | Cohesion: A Class Does One Thing Well | The 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 tool | Coupling: Minimize What a Module Needs to Know | The 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:
- "I split the class into two files, so the cohesion is higher now."
- "This getter returns the internal
ArrayList, but the field isprivate, so the class is encapsulated." - "
Square extends Rectanglecompiles and the tests pass, so Liskov is satisfied." - "I added an interface with one implementation so we can swap it later."
- "This method used to be 150 lines; I split it into 15 ten-line methods named
step1throughstep15."
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:
fun handle(x: List<Any>): List<Any>// sorts customers by nameabove a method that sorts by creation date.- A 20-line method extracted as
step1,step2,step3, each called once. - A boolean parameter named
flagpassed toprocess(data, flag). - A class named
UserDataManagerwith methodsgetUserList(),processUserData(),handleUserInfo().
Smell Identification Clinic
Source: practice/03-smell-identification-clinic.md
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?)
Repair Protocol
For each real mistake:
- Reproduce the failure on the smallest example, trace, proof, query, command, or design sketch.
- Name the hidden assumption.
- Repair the artifact.
- Save evidence that changed: failing then passing test, corrected proof step, revised diagram, safer command, benchmark, or review note.
- Add one retrieval card beginning with Check... before... or Do not use... when....
Mistake Log
| Date | Mistake | Symptom | Root cause | Repair evidence | Retrieval card |
|---|---|---|---|---|---|
| Starter | Pick one radar row above | Explain how it would fail in this module | Name the assumption | Add a counterexample or corrected artifact | Write 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.