Jeremy Miller joined the fray. He comes down in support of Oren’s post. Then there’s this post by Adi. He more or less comes down in support of my post. But the most startling thing I read was this:
I have been reading another post war (I bet Oren really enjoys them) between Oren Eini and Chris Holmes.
Wait a second - there’s a war here? When did that happen? Why does every “conversation” on the blogosphere have to be a “war” when even the slightest of opinions differ? Can’t people with different opinions have a civilized conversation without it being a “war”? I know they can, because Oren and Roy did it a week ago.
I’m guessing that this appears as a “war” because of my own poor writing skill. I conveyed my thoughts poorly, making it sound like I disagree with Oren, and as such now people think I’m on some “side” opposite him. But the reality is much further from that.
I’ve always been a guy who believes in “build it yourself”. I look for that same attitude in people we hire. The reason for that is because 95% of the time when you look for a solution off the shelf, it won’t do exactly what you need it to do and you’ll have to spend a lot of time customizing it, adapting it or altering it to fit your needs. Wasted time, especially when you could have just written it yourself and it would fit your needs 100% with no additional baggage.
So does that sort of belief put me very far from guys like Oren and Jeremy? I don’t think so. I think, actually, we’re very much alike.
There is one thing I don’t believe in, however, and that is absolutes. I don’t believe that one language is king, or that one vendor is king, or that one way of doing things rules every time. I don’t believe that building something yourself every time is always going to be the answer. I leave open the possibility that there might be another solution. I believe in the Toolbox; a place where you go to find the best tool for the job. And every job is different.
A Quick Response To Jeremy
And yes Chris, I’d much rather use my own fully-featured StructureMap tool than deal with the very limited ObjectBuilder DI tool embedded inside the CAB. Guilty as charged.
You know what? I’d be shocked if Jeremy felt any other way. I’d also be disappointed. He built StructureMap; if it wasn’t better than the other tools (in his eyes) then he should be using whatever he thinks is the best.
I’ll also say this about ObjectBuilder : I agree with Jeremy; I wouldn’t use it on its own. It’s hideous. It is overly complicated, undocumented and cumbersome. It is the worst part of EntLib and CAB. Fortunately, when using EntLib and CAB I don’t have to manipulate ObjectBuilder. If I did, I’d have abandon both tools a long time ago.
So we come to this question: If I don’t like ObjectBuilder, then why am I using CAB or EntLib?
The Decision Making Process
I said I think every project is unique. But not just the project, also the environment surrounding it. The forces surrounding a project determine how I approach solutions. Oren and Jeremy stick to their guns a bit more than I do when it comes to the “grow your own” tenet. I want to make it clear: I don’t think that’s a bad thing; and I don’t disagree with them. They do what works for them and I think that is the responsibility every developer has to deal with.
Why did I choose CAB? Because at the time, I knew there were things we would need in our code base to help us be productive. I had two options: roll my own, or choose something that provided the functionality for me. I looked at IoC containers and I looked at CAB. The latter looked to me like it had a lot more functionality out-of-the-box than an IoC container. EventBroker, CommandHandlers, Workspaces, WorkItems (the IoC container), support for MVP… It looked like a lot of the features we would build ourselves were already there. And it also looked like we wouldn’t have to adapt or alter large chunks of the source code to get what we wanted.
Now, some people might say “that’s Big Design Up Front”. I’d argue otherwise. Our ultimate goal was testability. We wanted to adopt an MVP architecture so that we could have a very testable UI layer. We wanted automated tested; we wanted automated builds; we wanted the confidence that comes from having a vast suite of unit tests; we wanted the confidence to refactor our code without fear of breaking a tightly coupled system. So our goal was not to have “nifty tools”, but to have a framework to build upon that would give us our ultimate goal: a testable UI layer that we all would have confidence in.
With an IoC container I would have still had to develop a lot of functionality myself. I wasn’t afraid of doing that (and I am NOT against that), but I also didn’t know how much time it would take. My assumption was that it would take a considerable amount of time (and not as BDUF; but as time spent building the pieces when necessary. The bottom line is, it still takes time, no matter how you allocate it, and I wasn’t certain how much). That assumption was probably unfortunately influenced by looking at the CAB as a frame of reference and saying, “Holy cow, there’s a lot there…”
So we went with CAB. The idea was that we thought it would help us get out of the gate faster. I thought it would take less time to grok the CAB and make use of it than roll my own code. Maybe that was an error in judgment. It’s certainly possible, I am human and very flawed. But I did manage to grok the CAB pretty fast compared to other adopters, so it seemed like a good decision to me at the time.
Would I Make The Same Decision Again?
In the end, we got what we wanted. We got a very testable UI layer, and we got it with minimal pain and effort. Yes, the CAB can appear complicated at first, but once I grokked it it seemed very easy to use. Yes, the CAB does things in a strange way at times; there are points where you look at the code (Controlled WorkItems being a primary example) and go, “Why the hell did they add that layer of indirection? It just makes the whole thing more complicated”.
But fortunately, the CAB isn’t a tool fixed in stone. It’s very easy to tweak it to do things the way you want it to do them, at least in many of the more frequent scenarios. And that’s what we’ve done to remove some of the complexity. We just use the CAB but we make it more simple. Of course the obvious comeback is, “Why not just build it yourself?” Which is the thrust of Oren’s argument. And he’s right, I think, in many respects to ask that question.
I chose CAB because I thought it was the best solution at the time, given everything I knew about software design and weighing all of the other factors involved. I might make a different decision today, given the amount of knowledge I’ve accumulated and the tools that have emerged. I might do just what Jeremy and Oren propose, and grab an IoC tool like Castle and grow my own solutions as necessary. That sort of thing appeals greatly to my “do it yourself” attitude.
But I don’t regret choosing CAB. We’re productive with it. It gives us good value for very little effort. It doesn’t cause us pain. And it doesn’t appear complicated (at least to me).
The Bottom Line
To me, the most important thing is delivering tested, maintainable code that meets the customers needs in a timespan they can stomach. And whatever tools or tenets a person uses to reach those ends, I can’t argue with if they’re achieving their objectives.