Managed Extensibility Framework Preview Available

A few months ago we announced that we are working on a Managed Externality Framework and there was a lot of feedback just on the announcement!   Today we posted the very first CTP of MEF.    I would love to get your feedback on this. 

Many people have noted that the industry has not yet achieved the level of code reuse the Object Oriented Design promised.  One of the reasons for this is the tight coupling that most OO systems tend allow.  Over the last few months (and for some of us, years) we have thought deeply about how we can encourage more reuse.    We believe MEF is part of the solution. 

The MEF provides developers with a framework to easily add extensibility to their applications and with minimal impact on existing code. The application developer can define extension points according to the functionality required of an extension, while the extension developer uses those points to interact with the application.
MEF enables this extensibility to take place without creating a hard dependency in either direction. Applications can be extended at run time without recompilation, and extensions can be used by multiple applications sharing the same extension requirements. MEF also allows an application to delay the loading of an extension while still examining its metadata, enabling efficient traversal of large catalogs of extensions.

There are some great samples included:

HelloWorld: A very simple example to show the concepts.   The Button's Caption is determined at runtime by what component is added.  This can be changed at runtime, and customized based on user, etc.

 public MyHelloWorld()
{
    InitializeComponent();
    CompositionContainer container =
              new CompositionContainer();
    
    container.AddComponent<MefHelloWorld.MyHelloWorld>(this);
    container.AddComponent<ExampleStringProvider>(new
      ExampleStringProvider());
    
    //Alternatively, comment the above and 
    //use the DateStringProvider:

    // container.AddComponent<DateStringProvider>(new
    //               DateStringProvider());

    container.Bind();

    //theButton.Content = "Hello World!";
}
[Import("ButtonCaption")]
public String ButtonCaption
{
    get { return theButton.Content.ToString(); }
    set { theButton.Content = value; }
}

DirectoryWatching: a "Hello World" example, using Directory Watching rather than manual component insertion.  You can simply drop a DLL into a directory to enable new functionality in the app

Calculator: a stack-based calculator example..  You can add some "advanced" opperations that happen to be written in VB just by dropping the extension into a directory. 

image

You gotta have a game right??    Simply open the file menu to load some additional shapes

image

XFileExplorer: a MEF-based file explorer

Again, we'd love to have your feedback and thoughts on this very, very early preview.