TypeMock v IoC (Round 1)
Lots of discussion has kicked off about TypeMock v IoC:
- Pro TypeMock - I don't agree with some of this, though I can see the authors point. For me the arguments for depdendency inversion are all in Robert Martins excellent book.
- Good Summary - Agreeing with both camps seems sensible :)
- Pro DI - Good summary of where DI is useful.
- Pro DI 2 - Another discussion on where DI can help.
- DI In Context - Really good post with the start of a (hopefully) long and important discussion of how DI relates to different layers.
- DI and other patterns - Interface programming, SRP and the rest.
- More Pro DI - Another good article on it.
When writing an application, you may well be able to analyze in advance to see where you need pluggability points and provide interfaces there. Adding interfaces where you don't anticipate any use for them would of course be a violation of YAGNI.
I really like interface based programming and buy into it. In particular Robert Martins book (one of my favorite programming books) really goes into depth about how to decouple systems. However there is a cost and if you apply the principles too widely I think you get a mess, in particular when you are talking about your core domain/business classes.
I also don't fully agree with the vociferous arguments against TypeMock, I think it can be quite useful where you've looked at your design and decided your happy with it but you also want to do a bit of mocking.
No comments:
Post a Comment