I'm very aware of the fact that such a question has probably been posted already. Yet with the involvement of IoC in this case and a lot of code I've seen a colleague in a company I'm new in made this question arise.
Scenario:
In the codebase of one product this colleague build every interface is implemented explicitly. The whole application is constructed through structure map, yet in some places the concrete types are used and cast like this
((IInterface)concreteClass).SomeMethod()
Background:
That colleague explained to me, after asking what it is about explicitly implementing all interfaces, that they introduced StructureMap recently and many people would still just use the concrete types. So in essence it's a means to "educate" people in the company.
My cents on the matter:
First of all, the switch to StructureMap has been done several years ago and while this, sort of, forces to use interfaces more, in my opinion this is not the right way. The way I see it, people who know about the concrete type can see the implementation and easily to what I showed above... just cast it. Clear communication or coding conventions would make this much better. If IoC is used and no concrete class, then explicitly implmenting an interface is completely useless.
I've also heard that this can really mess up inheritance, but don't know of an example. I've also seen Jon Skeet sort of discouraging from using it the way mentioned above, but rather the way it was intended to use, like with IEnumerable<> and other name clashes.
Can anyone shed some light on this matter for me. Pros and cons (although I'm highly biased to not doing it, hence my post here) and especially reasons why one or the other.
Thanks!
Edit: I'm very well aware that this is not a matter of right or wrong, nor is there a real answer. This is more of a question to learn to know deficits of each approach. Why would I use in one scenario one over the other approach?