Thursday, August 23, 2007

TypeMock v IoC (Round 1)

Lots of discussion has kicked off about TypeMock v IoC:

  1. 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.
  2. Good Summary - Agreeing with both camps seems sensible :)
  3. Pro DI - Good summary of where DI is useful.
  4. Pro DI 2 - Another discussion on where DI can help.
  5. DI In Context - Really good post with the start of a (hopefully) long and important discussion of how DI relates to different layers.
  6. DI and other patterns - Interface programming, SRP and the rest.
  7. More Pro DI - Another good article on it.
Ultimately I think both have their place and some of the comments are also insightful, in particular I liked Mats Helanders comments to Ayendes post:

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.

Share This - Digg It Save to del.icio.us Stumble It! Kick It DZone

No comments:

Post a Comment