“MEF in 2 hours or less”, I am all for it.
Some posts titles just really grab you. I couldn’t help but think about one of those annoying ads in the back of magazine when I saw this post from Ayende. In actuality the article is more of a “How I can implement what I need from MEF in 2 hours” however that’s not as provocative 🙂
The main point Ayende makes in the article is that folks talk about specific features in MEF like dynamic discovery and lazy loading as big deals, and he can implement something similar in a few hours. As I mentioned in the comments, I think Ayende is over generalizing on exactly what capabilities MEF actually provides, but I have no problem with that statement, just as I had no issue with Jeremy saying “Build your own CAB”. I went on to say (paraphrasing) “MEF is not built for you, it’s for the ecosystem”.
What I mean by that is this, MEF is designed for supporting a rich ecosystem of extenders, it establishes a standard for extensibility that crosses application boundaries. If you are a third-party extending an application built on MEF, you just need to speak the language. You can walk up to any application that speaks that language and you are golden. Eclipse / OSGI is a prime example of this (not talking about the Experience but the extensibility). Visual Studio’s Editor in 2010 is another prime example.
With MEF we’re saying you don’t have to be Eclipse / Visual Studio to provide the same type of experience. With MEF you can get off the ground with a few keystrokes, and without reading a 200 page manual. Of course that just gets you in the door, and as you scale up to use more advanced features MEF get’s more complex in fact, if you get to the Primitives you almost need to be a rocket scientist. However, you have a dial. If all you want to start with is using MEF for loading a small collection of plugins, you can do that with ease. Over time you can scale up according to your needs. As you scale you may find many of those features that you may not need today are a welcome addition.
Now back to Ayende’s comment, if you are not using MEF for it’s ecosystem enabling capabilities, and you do not find the features it provides adequate, then feel free to NOT use it. Don’t worry, we’re not going to send the MEF police to your door! (Though don’t be surprised if I ping you personally over IM 🙂 )
I am not saying that to drive you away from MEF, I am saying that saying NO is a valid option if it doesn’t meet your needs, and you can find/create something that does. If it does however meet your needs, saying no “just because” is silly.
I’ll close with this statement, there’s much more to MEF than meets the eye. I advise taking it for a ride before you discard it.