and reading the chapter on DIP (dependency inversion principal, the first example by Jimmy Bogard, is slightly confusing.
in his example he takes a class that has two dependencies in the method he wants to use and he then extracts them out as interfaces to decouple these two dependencies from the class. Ok! Good! He then passes the interfaces into the constructor so that he has them to use. Good again.
But he doesn't extract out a third object he is passing into the method that he uses in the method, as if this object being passed in isn't a dependency.
My question is: if you are passing in a concrete implamentation of an object into anotherobject method, isn't that a dependency, regarless of when or how it is being used in the method?
In order to trully make it decoupled, don't all object being passed around have to be abstracted out as interfaces and passed into the calling object via interface?
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)