I was browsing SO and came across this comment on an answer:
Why do we go through the ceremony of extracting an interface when we can DI a delegate to make it testable?
This articulated a thought I had earlier in the year. Is there anything inherently wrong with injecting pure functionality (function pointers, I guess) instead of interface implementations?
The word 'ceremony' in describing interfaces sounds suspiciously like a comment from a Ruby-ist who anti static-typing. With a good refactoring and templating tool, most of the ceremony goes unnoticed anyway.
While passing in a delegate has its place, IoC with interfaces is normally easier to implement, use, understand, and maintain.
Consider a typical constructor:
Now consider a class that returns an interface for consumption by another:
In looking at latter consumption example, the obvious cleanup would be:
which means you need an replace the class type with an interface for mocking.