We’ve previously dived into the complexities and maintenance challenges of switch-case and saw a refactoring technique for simple scenarios.
Today, we’ll raise the bar a bit and focus on situations when our type code affects behavior. We’ll use pets to demonstrate the concepts.
Replacing Type Code With Subclasses
We’ve previously dived into the complexities and maintenance challenges of switch-case and saw a refactoring technique for simple scenarios. Today, we’ll raise the bar a bit and focus on situations when our type code affects behavior. We’ll use pets to demonstrate the concepts.