If you read this blog with any regularity you know that my workplace adopted CAB a while ago. At the time we were inspecting CAB we looked at a lot of other things; we looked at IoC containers like Spring.Net, PicoContainer.Net, etc. But what we found with the CAB was that it offered more than an IoC container; it offered a whole slew of other features (EventBroker, CommandHandler, Workspaces) that made our lives easier and more productive. It gave us a consistent way to tackle repeating problems.
Today, Ayende decided to bash the Patterns & Practices team at Microsoft. He also took a shot at CAB.
All I can say is I’m terribly disappointed. Ayende’s blog comes through my aggregator and I read his posts every day. Reading his blog is interesting; I don’t always agree with what he says, but many times I do. And often his insight comes from a place of deep knowledge. That’s why I read his blog; because he knows things and doesn’t just spout off uninformed opinions.
At least, until now.
His comments on the CAB appear to come from a place of deep ignorance. They are the same comments I’ve read from other people who have taken a cursory look at the CAB and dismissed it as “too complicated”. Instead of taking the the time to actually grok the technology, they just bash it.
The CAB is a good example, I like some of the ideas there, but it comes with so much weight around it that it is not worth bothering. I can build on the same ideas in half a day and end up with a far more light wieght approach, easily testable and easier to explain to the next developer.
Not worth bothering? Maybe if bothered with, the benefits of the framework would become apparent. It’s possible that Ayende thinks it’s just a bloated IoC container not worthy to lick Castle’s boots. And that would be unfortunate because CAB is way more than an IoC container.
But the part that really puzzles me is the “weight” comment. Now, I’ll concede there’s a learning curve involved with CAB. It takes some time to grok the framework and what it is capable of doing. But once you do, it’s simplicity of use and flexibility makes it very attractive. That said, I don’t think the learning curve is what Ayende is talking about. My guess is that he’s talking about the amount of code included in the framework and the amount of code you have to write to make something work in CAB.
The amount of code in the framework doesn’t seem to me to be any more than any other framework when you take into account that CAB is doing a hell of a lot more than IoC. And the amount of code you have to write to actually make a CAB application work seems like a pittance compared to the benefits you gain from using it.
Then there’s this comment:
The stuff that they release almost always build on the naked CLR, it tries to build on top of that something to ease the pains of people who are working with that. The problem is that if you are doing that, you may be making great strides in making a developer life easier, but you are taking them in the completely wrong direction.
The wrong direction? What direciton would that be? Productive?
I don’t know where Ayende works or what sort of environment he works in, but I know he gets a lot of time to blog and maintain his own open source mock framework. Not everyone has that luxery. We have to get real work done under time constraints. We have customers who expect results yesterday. We’re in the trenches trying to implement features for customers who have unrealistic expectations about when things should get done. That’s just a fact of programming life in many business environments. It doesn’t matter how often we explain Agile to our customers, they still think in terms of deadlines and they want everything now. Anything that helps us achieve our goals is a good thing.
Tools like CAB and Enterprise Library help us achieve our goals in an expedient fashion. That’s the bottom line. They give us a consisten way solve problems.
Yes, we could sit down and write our own framework and it undoubtedly would be more lightweight than the CAB because it would serve just our purposes and not attempt to solve anyone else’s problems. But that takes time. Maybe Ayende is a supergenius ready to take the crown from Marilyn Vos Savant and that’s why he can claim to write his own CAB in half a day, I don’t know. I’d certainly like to see it; I’d like to see a lightweight CAB with all of the CAB’s features written in half a day. That would be impressive.
Mostly, though, I think Ayende just hasn’t done his homework, which seems really out of character for him. He tries to act like he has done his homework:
I am not speaking blindly here, it took me 40 minutes to repreduce the policy injection block.
This brings up a really good point: There are tools out there that can accomplish certain tasks. If Microsoft builds another tool on top of something, which tool should they choose? If the P&P guys were going to build CAB without ObjectBuilder, for instance, then what IoC container should they have used? Would it be a good idea for them to build CAB on top of Castle Windsor? Would that be an endorsement of Windsor that Microsoft would deem unacceptable? Would it be acceptable for them to build Enterprise Library using Castle Windsor?
I can see why P&P builds their own pieces: they don’t want to rely or endorse 3rd party OSS.
The fact that P&P has built their own tools, like ObjectBuilder and the Policy Injection Block, seems like an unfair reason to condemn the whole Enterprise Library. Like saying, “one aspect of this thing sucks, so the whole thing is useless to me.”
Of course, that’s pretty Ayend’s modus operandi. If something is of no value to him personally, it must suck. Even his buddy Roy Osherove had to call him out on that behavior lately.
But what’s more baffling is this comment:
When looking at the stuff that the P&P produce, I see things that are extremely complex to their purpose, hard to use and maintain, and don’t really add any value to me from where I stand today.
When I read Ayende say that the P&P’s tools are “extremely complex” and “hard to use” I almost can’t believe it. Ayende is a smart guy. So how come he can’t grok Enterprise Library and the simplicity of the tools?
My guess is that this all has to do with familiarity. And every single one of us programmers is guilty of this behavior: we learn the tools we like, and when something else comes along, if it’s not immediately apparent that it is simpler and easier to use (even though it may be) then we dismiss it. And I’m just as guilty of this as Ayende is.
It took me a while to grok exception management and logging using Enterprise Library. For a long time I considered using some other tools, but because I’m stubborn I decided to keep at it until I had it figured out. And at first EntLib did seem complex and hard to use. Then the light bulb went on on my head and I got it. And holy cow, is it ever easy to use. It’s not complex at all; it’s not hard to use. It just has – like many things in life – a learning curve.
At the end of the day this all boils down to productivity. Ayende’s suggestion is often: cobble together your own solution. But why should everyone have to reinvent the wheel? What is wrong with P&P coming along and saying, “Hey, we see this common problem, we’ll provide a solution. You don’t have to use it, but if you don’t want to take the time to build your own, go ahead and use this.”
How many developers need a framework like CAB? Judging from the message boards and downloads, I’d say a lot. Ayende wants to build is own in half a day. Great, he solve his problem, but what about everyone else who still has the same problem? Will Ayende solve all of our problems?
The solutions from P&P may not be perfect. And when they’re not, we are free to choose a different path. But I find it really difficult to fault them for providing solutions that help developers be more productive.
And I find it disturbing that someone as smart and respected as Ayende would stoop to bashing P&P and making claims like, “I can build on the same ideas in half a day and end up with a far more light wieght approach”. That comes off sounding rather ignorant (and insulting), especially to those of us who have grokked the CAB and use it every day.
I guess, more than anything, I’m just jealous of Ayende. I wish I were as smart and fast as he is. Because I know it would take me a lot longer than half a day to build a framework like CAB that had all of the features that CAB has. And that is why we elected to use the CAB; because when my boss asked me how long it would take for me to build a simliar framework, I didn’t say half a day, I said a lot longer. So to be productive we turned to the CAB.
I’m just jealous; I’m too slow and dumb.

