4 ms·
Speaking as someone who has implemented bank accounts... Would you agree that all of our problems go away if we exposed an Account interface rather than an Acc
by raganwald 19y ago
Speaking as someone who has implemented bank accounts...
Would you agree that all of our problems go away if we exposed an Account interface rather than an Account class? Then the impact of our choice about how to re-use the implementation is localized.
- Retric 19y agoThat brings up new issues as you now of 2 Account classes with identical functions in some areas and slightly changed functions in others so keeping fixes up to date can be an issue. IMO you can build an interface and an abstract class that implements that interface with 2 subclasses for checking Account vs IRA Account but I think the abstract classes works just fine on it's own.
- raganwald 19y agoIn that particular organization there is an interface hierarchy that is distinct from its implementation hierarchy. And in the implementation hierarchy, they avoid overriding existing methods in favour of using abstract classes. This might be what you are suggesting. The ultimate goal is to avoid using public inheritance to model WAS-A.