3 ms·
> What would be the downside of FileImporter being a base class with a few subclasses for each file type? This model doesn't support a single class having mult
by nicoburns 7y ago
> What would be the downside of FileImporter being a base class with a few subclasses for each file type?
This model doesn't support a single class having multiple base classes very well, whereas this is supported very well by the Swift/Rust approach. Base classes typically also allow shared state between base and derived classes, which can make code brittle and difficult to follow.
- WoodenChair 7y ago> This model doesn't support a single class having multiple base classes very well, whereas this is supported very well by the Swift/Rust approach. Totally agree, but you can have a single base class that adopts multiple protocols or subclasses that adopt multiple protocols. It doesn't have to be an either/or. Inheritance can work together with protocols.