Plugin architecture (Extensible Application Architecture)
Upcoming SlideShare
Loading in...5
×
 

Plugin architecture (Extensible Application Architecture)

on

  • 1,490 views

How to develop extremely extensible software applications. Here we use MEF and MAF to achieve the same.

How to develop extremely extensible software applications. Here we use MEF and MAF to achieve the same.

Statistics

Views

Total Views
1,490
Views on SlideShare
1,490
Embed Views
0

Actions

Likes
1
Downloads
17
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment
  • In Slide Show mode, click the arrow to enter the PowerPoint Getting Started Center.

Plugin architecture (Extensible Application Architecture) Plugin architecture (Extensible Application Architecture) Presentation Transcript

  • Plugin Architecture Leveraging the benefits of Extensible Application Architecture
  • Extensible Application Architecture  A very important principle of Application design is the Open-Closed Principle (ref S.O.L.I.D. principles of software design).  The Open-Closed principle states that “Software entities (classes, modules, functions, etc.) should be open for extension, but closed for modification”  It is generally achieved by using abstractions, or by placing behavior(responsibility) in derivative classes.  A truly Extensible Software design should allow 3rd Party/External developers to extend and enhance it further even after they have been compiled and released.  This is possible only if we design our application to be easily Pluggable.
  • Plugin Architecture Plugin is any piece of software that extends or changes the behavior or interface of an existing, compiled application. For the plugin to be able to extend the any application, the existing application must itself be designed so that its is Pluggable (Implementing a Plugin Architecture). Examples of applications having a plugin architecture are MS Office, Visual Studio, Eclipse IDE (Java) Why/When do we need a Pluggable Application (Benefits)?  To allow applications to be extended after they have been compiled and released.  To allow other applications to be able to connect to and enhance your application in a standard BUT isolated way.  To make Unit testing easier for teams working on different modules/Plugins.  When we are designing a solution which should accommodate disparate requirements implemented by other vendors in the future. Eclipse IDE platform Architecture
  • Building Extensible design in .NET Microsoft .NET already provides us with a few tools and libraries in order for us to get started with designing Extensible Architectures. The most popular of them all are MEF and MAF. Both are exclusive to each other but can be used in a complimentary manner. A feature-by-feature comparison is as under : Managed Extensibility Framework (MEF) Managed AddIn Framework (MAF) Primarily focused on providing extensibility Provides extensibility along with Isolation All the extensions are loaded in to the same AppDomain as the primary application All AddIns are loaded in separate AppDomains. Dynamic Discovery of Extensions AddIns must be installed before use. No dynamic discovery. Extensions cannot be unloaded at runtime AddIns can be installed/uninstalled without affecting the primary application. The whole application might crash, if and extension has an error/ Since the AddIns run in their own AppDomain, they do not affect the primary application in event of error. Easier to Implement Costly in terms of time, effort and Complexity.
  • Plugin Architecture Use Case Scenario (MEF+MAF) A custom implementation of a Plugin Architecture using useful features and principles from both MEF and MAF is as under :  The initial Plugin discovery needs to be done using MEF as it supports dynamic discovery of assemblies of a known type in folder.  There is Shared contract which is present in both the Host and the Plugin which assists in the Dynamic Discovery of Plugins.  Info about the loaded plugins such as name, file path, version etc. are stored in a static in-memory collection to be used later.  Plugins are loaded in their separate AppDomains (MAF Principle) as needed (using information from the static in-memory collection), which makes it easy to Load and Unload them.  Since Plugins run in separate AppDomains, they do not affect the Host application in the event of failure/exception.  The communication between AppDomain is a Custom implementation and is achieved using remoting (MarshalByRefObject)  The Plugin Architecture extends to the Plugins as well. Meaning a Plugin itself can also be a Host to other Plugins.
  • Plugin Architecture Use Case Scenario …continued Illustrated below is a custom implementation of a Plugin architecture.  Each one of the modules (Plugins) below in boxes work independent of each other and communicate via a custom implementation of Remoting. WCF Service (Hosted inside Windows Service) Service A [Plugin] Service Application Service B [Plugin] WPF Application UI Duplex Communication [WCF NamedPipes] UI Application (Shell.exe) [Plugin Host] [Plugin Host] Plugin Y [Plugin] [Plugin Host] Plugin X [Plugin] Service C [Plugin] Future Service [Plugin] Application 1 [Plugin] Application 2 [Plugin] Plugin Z [Plugin] Future App [Plugin]
  • Glossary Term Description Plugin A piece of software that extends or changes the behavior or interface of an existing, compiled application PluginHost A Pluggable application which can be extended using Plugins. AddIn A piece of software that extends or changes the behavior or interface of an existing, compiled application (same as Plugin) MEF Managed Extensibility Framework (http://msdn.microsoft.com/en-us/library/dd460648.aspx) MAF Managed AddIn Framework (http://msdn.microsoft.com/en-IN/library/bb384200.aspx) AppDomain The logical and physical boundary created around every .NET application by the Common Language Runtime (CLR) to isolate applications from each other (http://msdn.microsoft.com/en-IN/library/2bh4z9hs.aspx) Remoting A means to establish Inter-process communication within the same machine (http://msdn.microsoft.com/en-us/library/kwdt6w2k(v=vs.71).aspx) WPF Windows Presentation Foundation – Used to create Rich Client Applications (http://msdn.microsoft.com/en-IN/library/ms754130.aspx) WCF Windows Communication Foundation – Used to create highly scalable and flexible services (http://msdn.microsoft.com/enus/library/ms731082.aspx) Named Pipes A mode of communication used by WCF to established Inter-process communication on the same machine.
  • A solution based on Plugin Framework might be considered as Extreme Extensibility and is not Extensible Applications the way to go for every software design. A Plugin architecture is expensive to implement and must be decided after much thought. Refer the link below to learn more. Find out more about implementing a Plugin Framework with MEF and/or MAF (Click the above link in Slide show mode)