Friday, July 15, 2011

Microsoft Extensibility ( MEF 4.0) :-

Writing an extensible application is always a challenge , considering the incorporation of future functionalities that are not known at the time of designing application architecture.  Extensible application basically consists of the core framework that has to remain unchanged and work as the base engine for application , extending the application at runtime.

One very good example of extensible application can be seen in design architecture of the Sharp-develop  IDE.  I have previously blogged about the Sharp-develop and its design . Sharp-develop application consists of base engine -SharpDevelop.Core ,  which is the responsible for loading up all the add-ins and extending the application at runtime.  

SharpDevelop uses add-in based extensibility . Microsoft has always provided the extensibility framework to design our application upon . Add-in based framework such as Add-in pipeline framework let us to create a host application and expose its Object model to be extended by the application addins . There is well defined architecture for this kind of application development  consisting of Host,  Hostadpter, Addinadpater, Addin . You can look my previous blogs on add-in pipeline development for detail into architecture. One good example of application that follows the Add-in pipeline development is VSTA  (Visual studio tools for application) which uses the addin framework provided in System.Addin and its sister namespaces. Details for VSTA can also be found in my previous blog entries.

The new child on the block in the arena of extensibility from Microsoft is MEF (Microsoft Extensibility Framework). It is projected as the extensible framework and also have the capability of DI (Dependency Injection) as Unity framework. While Unity framework is DI framework , MEF work as extensibility framework along with DI capabilities . For detail in to MEF programming you can check my previous blog entries .

I have my share of experience  of developing application using MEF .  Although MEF acts great whereas its DI capabilities and functionalities are concerned , but lack of support for standard publish/subscribe mechanism and modularity functionalities within the framework itself  is somehow concerning.  We have to use MEF extensions provided within PRISM library to fully achieve extensibility features.  PRISM with MEF is great , where we have to develop an extensible UI based application . It provides us with standard publish/subscribe mechanism which is loosely coupled with in the application and uses weak references for events. Then we have Modularity in form of IModule which help us to get a extensible UI based application. There are all other great  features of PRISM , but if we can get the above said features right in MEF it will  greatly ease the development of application which is not UI based .

Hopefully I will write some details upon MEF extension within PRISM 4.0 .