Replace Type Code with Subclasses¶
Fowler, M. (2019). Replace Type Code with Subclasses. Refactoring: Improving the Design of Existing Code.
Cited by¶
1 citation across 1 artifact.
Each citation links to the sentence it supports in the citing article.
Primes¶
- Type–Token Distinction
- When lower-level variation stops being noise and starts being systematic — when some subset of occurrences reliably behaves differently from the rest — the correct response is not to widen the form's tolerance until the outliers fit, but to introduce a level: split the form, or promote the recurring variation into a form of its own with the original standing above it.
This sourcePrescribes introducing a subclass level when a code marks a subset of instances that behaves differently, rather than absorbing the variation inside the original class; listed with the earlier name Extract Subclass as an alias.
- When lower-level variation stops being noise and starts being systematic — when some subset of occurrences reliably behaves differently from the rest — the correct response is not to widen the form's tolerance until the outliers fit, but to introduce a level: split the form, or promote the recurring variation into a form of its own with the original standing above it.
Verification¶
This reference passed the adversarial substantiation pipeline: it was checked to exist and to support the claim it is attached to. See how references were verified.
Registry ID ref:5800cc303ff9 · see in the full table