Project Silk subjective review part 3 IoC a problem child

This is part 3 of my http://silk.codeplex.com/ review.

IoC miss usage is a most common problem in many applications and first thing I usually look at.

I choose random action method called Add from FillupController:

Do you see that Using stuff, let’s have a look:

Duh, so it’s says we are creating an object using service locator, not a good practice.

What is more curious the FillUpController has no properties at all:

On the other hand there is a custom controller resolver which uses IoC Container.

Now testing a controller requires mocking IoC controller:

What I would do

  • The simplest thing: extract interfaces from all instances resolved with Using  register it in container and just put a property dependency.
  • When you look closer at all that Using calls it’s kind of miss implemented CQRS( with all that handlers stuff in my last post), but the if project is so simple so why bother?
Tagged , ,

One thought on “Project Silk subjective review part 3 IoC a problem child

  1. foobar says:

    Dude,

    “Subjective review” is a misnomer. Reviews are ALWAYS subjective. NOBODY has ever been able to write an objective review.

Leave a Reply

Your email address will not be published. Required fields are marked *