Lab 4 — Scripted Refactoring¶
Goal¶
Automate a sequence of small refactorings that moves code toward a design pattern.
Example targets:
- conditional → Strategy;
- telescoping construction → Builder;
- direct vendor dependency → Adapter;
- subclass explosion → Bridge;
- optional responsibilities → Decorator.
Required safety checks¶
- parse/type/compile success where applicable;
- precondition checks;
- tests before and after;
- deterministic diff output;
- rollback on failure.
Report¶
Explain which parts of the transformation are syntactic and which require semantic/design judgment.