Subclasses are a common method of achieving reuse and polymorphism, but inheritance has its drawbacks. See Composition Over Inheritance⭐ for reasons why you might decide to avoid an inheritance-based model.
During this refactoring, we will replace the subclasses with individual strategy classes. Each strategy class will implement a common interface. The original base class is promoted from an abstract class to the composition root, which composes the strategy classes.
This allows for smaller interfaces, stricter separation of concerns, and easier testing. It also makes it possible to swap out part of the structure, which would require converting to a new type in an inheritance-based model.
When applying this refactoring to an ActiveRecord::Base subclass, STI is re- moved, often in favor of a polymorphic association.