Unit 16 · lesson
Checkpoint 5: Tested and Refactored Program
Take a nontrivial Java program from an earlier unit and improve its structure without intentionally changing its required behavior.
Baseline
Before refactoring, submit:
- program requirement;
- architecture/call diagram;
- passing behavior set;
- at least six purposeful tests including normal, boundary, and invalid cases;
- one preserved Version 1 defect or design problem.
The tests may run through the browser harness. Full-JDK learners should encode the appropriate set in JUnit 6 as well.
Debugging record
For the Version 1 defect, show:
reproducer
expected result
actual result
boundary trace
first divergent state
hypothesis
controlled experiment
root cause
Refactor
Choose one meaningful structural improvement, such as:
- extract/decompose methods;
- replace repeated variables with a collection;
- introduce a coherent class/record;
- move behavior to the object that owns the knowledge;
- introduce an interface/constructor-injected collaborator;
- replace an unjustified inheritance relationship with composition;
- separate parsing, domain logic, and output responsibilities;
- divide a growing program into a planned package/file structure.
Explain the design problem the refactor addresses.
Regression evidence
After refactoring:
- rerun the original behavior set;
- rerun the defect regression case;
- add at least one new test made easier or more meaningful by the improved structure;
- document any intentional behavior change separately instead of hiding it inside the refactor.
Environment evidence
State which execution lane you used.
If you used a Java 25 project environment, include project/JUnit evidence. If you used the browser core, do not claim filesystem, package, dependency, or JUnit-runner execution that did not occur.
Mastery standard
The strongest submission demonstrates three things at once:
- you can locate a defect from evidence rather than random edits;
- you can change internal design deliberately;
- you can use regression evidence to defend the claim that required behavior survived the change.