Critical Thinking and Dissent is a Requirement

image So the fires continue to burn, as Joel Spolsky’s internet access hasn’t been disconnected.  For someone who is supposed to be an idiot and irrelevant, a lot of people still read and link to him.  I guess one guy is corrupting all the new developers, who are assumed to be reading Joel’s every word but in reality these developers probably didn’t know he existed until all these people linked to him saying he was wrong.

The lastest outrage seems to be this question on Stack Overflow: Why do I need an IoC container as opposed to straightforward DI code?

Now, before we get into the flames, let’s take a moment to actually look at the real question.  The use and benefits of Dependency Injection are not in question – not even by Joel.  The author has taken time to use the currently popular IoC and DI frameworks for his platform.  He is looking to understand the trade offs involved with using a framework and having to train his co-workers, and increasing the number of project dependencies.  Now, Joel’s response included:

The most valuable benefit of using an IoC container is that you can have a configuration switch in one place which lets you change between, say, test mode and production mode. For example, suppose you have two versions of your database access classes... one version which logged aggressively and did a lot of validation, which you used during development, and another version without logging or validation that was screamingly fast for production. It is nice to be able to switch between them in one place. On the other hand, this is a fairly trivial problem easily handled in a simpler way without the complexity of IoC containers.

Of course, we will ignore this sane and rational portion and focus on the one line zingers like:

I'm with you, Vadim. IoC containers take a simple, elegant, and useful concept, and make it something you have to study for two days with a 200-page manual.

...

I believe that if you use IoC containers, your code becomes, frankly, a lot harder to read. The number of places you have to look at to figure out what the code is trying to do goes up by at least one. And somewhere in heaven an angel cries out.

Never underestimate the power of developers to focus on a leaf in the middle of a forest.  In my view, this forest is using a framework versus using a pattern.  You could have DI by using Ninject (which I highly recommend to anyone looking for a DI framework), or you could roll your own DI (which I do quite commonly).

To many, these are mutually exclusive options and that one choice is always better.  This violates a core tenet of Agile – that we embrace change.  Each project should have a discussion if a framework is right for that project and that the decision is not permanent.  This extends beyond DI/IoC to every framework or line of code in the project – is it better to use an existing solution or roll our own?  There is no universal right answer here except “It Depends”.

Critical thinking and dissent on your team is a requirement for success.  If everyone accepts conventional wisdom (or worse, internet wisdom) without question, you might as hang up a sign that reads “because it’s always done that way.”


Posted 10-08-2009 12:00 PM by Michael C. Neel
Filed under: ,

[Advertisement]

Comments

KevDog wrote re: Critical Thinking and Dissent is a Requirement
on 10-08-2009 2:17 PM

Michael,

It wasn't the choice of technology that set people off, at least not me, it was the ad hominem bullshit and FUD that came along with it. Is there a single IoC container that has "a 200 page manual"? Are people who use IoC frameworks really so intellectually clueless as to not get that people are confused?

If he'd left it with "I usually roll my own, it fits my needs better", there would be no beef at all. It was knocking everyone else that was out of line.

James Curran wrote re: Critical Thinking and Dissent is a Requirement
on 10-09-2009 6:28 AM

I am both a beginner with OO & C#.  After reading about it in Sanderson's MVC book I was able to get multiple dependencies configured and running with Windsor.  Now, admittedly, it's "magic" to me, but, it just works.  No 200 page manual required.

jim d wrote re: Critical Thinking and Dissent is a Requirement
on 10-09-2009 6:55 PM

@KevDog

Well, I just did a print-to-pdf on the API and the training manual pages available from StructureMap.sourceforge.net.   The manual is about 80 pages and the documentation is over 200 pages.  So it seems like a valid criticism.  I can't find any docs available from ninject.org but to be fair I haven't extensively looked.  

I also don't understand your claim of ad hominem  attacks and I don't think the term means what you think it means.  Ad Hominem attacks are directed at people, whereas Joel is attacking ideas.  In fact the only person being attacked  here is... Joel Spolsky.  

About The CodeBetter.Com Blog Network
CodeBetter.Com FAQ

Our Mission

Advertisers should contact Brendan

Subscribe
Google Reader or Homepage

del.icio.us CodeBetter.com Latest Items
Add to My Yahoo!
Subscribe with Bloglines
Subscribe in NewsGator Online
Subscribe with myFeedster
Add to My AOL
Furl CodeBetter.com Latest Items
Subscribe in Rojo

Member Projects
DimeCasts.Net - Derik Whittaker

Friends of Devlicio.us
Red-Gate Tools For SQL and .NET

NDepend

SlickEdit
 
SmartInspect .NET Logging
NGEDIT: ViEmu and Codekana
LiteAccounting.Com
DevExpress
Fixx
NHibernate Profiler
Unfuddle
Balsamiq Mockups
Scrumy
JetBrains - ReSharper
Umbraco
NServiceBus
RavenDb
Web Sequence Diagrams
Ducksboard<-- NEW Friend!

 



Site Copyright © 2007 CodeBetter.Com
Content Copyright Individual Bloggers

 

Community Server (Commercial Edition)