A deliberately messy order-pricing service alongside a behavior-preserving refactor. The repo is designed for reviewers to compare implementations and see why each change matters.
- Demonstrates how to refactor under characterization tests instead of rewriting by instinct.
- Preserves behavior while introducing a clearer domain model and service boundary.
- Documents the progression so reviewers can judge the engineering decisions, not just the final code.
src/refactor_case/legacy.pyfor the starting point.src/refactor_case/service.pyandsrc/refactor_case/domain.pyfor the refactor.REFACTORING_NOTES.mdfor the reasoning trail.
pip install -e .[dev]
pytest -qv0-legacy → characterization tests → domain model → strategy extraction → explicit validation → production-oriented service boundary. See REFACTORING_NOTES.md.