I think will be largely subjective and depend on the implementation.
I usually don't make interfaces for my classes if they are just data containers, but if they have business logic functions, then I do.
Question
Our project requires us to interact with multiple sources for information like Oracle DB, SalesForce, etc. So we want to wrap all the calls under a WCF layer, so that anybody inside the company can use it. For implementing the Domain Objects, this is a consideration:
public class NoteTypeA : INote, INoteTypeA {}
public class NoteTypeB : INote, INoteTypeB {}
public class Customer : INote, ICustomer {}
All the Note classes such as NoteTypeA, NoteTypeB, NoteTypeC all would inherit from INote, however they also would Inherit from INoteTypeA, in the case of NoteTypeA.
I agree with the idea of using INote as it helps you implement Multiple Inheritance. But I don't get the reason behind using INoteTypeA and its looks like anti-pattern for me.
What do you guys think? Does that protect me from a future change? Does it help me smoothly add an out of scope change?
No correct solution
OTHER TIPS
I think will be largely subjective and depend on the implementation.
I usually don't make interfaces for my classes if they are just data containers, but if they have business logic functions, then I do.