As opposed to creating a concrete interface, superglued to the class it was designed for? I see little difference. Just because you are creating an interface, does not mean you are loosely coupling. If you have to create an interface for each class you create, due to the grainularity, you are actually creating more bulk.Chris Corbyn wrote:Except then you've tightly coupled your dependant class to a concrete class which will need to follow that code around everywhere == bulky.Jenk wrote:Let's also not forget that if an Interface is overly descriptive, you may as well not bother having an interface at all, and just use the classes interface as the er.. interface.
Getters/setters in interfaces
Moderator: General Moderators
Re: Getters/setters in interfaces
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
Re: Getters/setters in interfaces
I see what you're saying, but I just think any dependencies which are to be injected should have interfaces, not concrete types. I'm sticking to this very rigidly for this particular project since it's 100% DI-driven so far and it's probably the best code I've ever produced... I'd like to keep going with this seemingly simple, yet well-structured design.
Part of the reason I'm going down this route is to make it easier to swap out implementations (and for users to do so). It may become more apparent why after I release it
Part of the reason I'm going down this route is to make it easier to swap out implementations (and for users to do so). It may become more apparent why after I release it