Page 2 of 2

Re: Getters/setters in interfaces

Posted: Tue Feb 05, 2008 7:48 am
by Jenk
Chris Corbyn wrote:
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.
Except then you've tightly coupled your dependant class to a concrete class which will need to follow that code around everywhere == bulky.
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.

Re: Getters/setters in interfaces

Posted: Wed Feb 06, 2008 3:27 am
by Chris Corbyn
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 :)