I have 3 entities which are similar, but have different ways of doing certain things.
I use interfaces often and find them very useful, but here I chose a base class design for this approach, because the 3 share plenty of common code.
Only one method is public, and this sits on the Spender base class as the 'gateway':
public void SpendAmount(int budget)
My colleagues say I should create an interface for this base class, ISpender, with just the one method.
My question is - why? I've already achieved:
- Polymorphism
- Reduced repetition
- Encapsulation (only the one method is callable)
I can't see why anyone would benefit from mocking ISpender for testing.
The design is open for extension (a new type of spender can inherit from Spender)
What's the real added benefits of also incorporating an interface into this design specifically?