Development AntiPattern: Spaghetti Code - Refactored Solution
Refactor to generalize: Create an abstract superclass
1. Make subclass function signatures compatible
2. Add function signatures to the superclass
3. Make function bodies and variables compatible
4. Migrate common code to the superclass
Refactor to specialize: Simplify conditionals
1. For each condition, create a subclass with matching invariant
2. Copy the code into the subclass
3. Simplify code based upon invariant
4. Specialize the superclass constructor
Refactor to combine: Capture aggregations and components
Type A. Move members from an aggregate class to a components class
Type B. Move members from component classes to aggregate class
Type C. Convert inheritance into an aggregation