Pages

Showing posts with label Object-oriented programming. Show all posts
Showing posts with label Object-oriented programming. Show all posts

Sunday, April 24, 2011

Plugin Architecture

It’s interesting how Visual Studio and Eclipse IDEs work! These IDEs were built on top of Plugin Architecture.

Plugin architecture is pure loosely coupled system and its extensively using Object oriented capabilities and design patterns; polymorphism, abstraction, Factory, Service locator, Inversion of Control and Dependency Injection…etc.

While most of developers changes their way they're writing code, I think it’s a correction rather than change. It’s the only way to write an enterprise application that can respond to the rapidly changes of business without recompile code and release a new version. In plugin architecture the first (and every day) rule you'll follow is Separation of Concerns.

With plugin architecture the system is divided into two main parts; the core and the plugins (extensions).
The first part is the framework or the container that is responsible for manage your plugins; it’s the place where it lives in. The container loads all plugins and its dependencies and instantiates it to you, also it disposes plugins at the end of its life cycle.

The second part is all plugins that do -together - your business requirements; it’s the smallest component and it cannot be exists alone or run independently without the framework (known as application container).

The framework (the bulk of work) is done! You can choose between many Ready, Free, Open-source and stable frameworks such as:

  1. Spring Framework, supports both Java and .Net. In fact, it’s originally developed for java developers then they support .Net.

  2. Castle Windsor, The simpler, powerful and stable framework and can be used along with other libraries to build up and enterprise-level applications.

  3. Microsoft ObjectBuilder, “ObjectBuilder itself is not a dependency injection system; it is a more general purpose and extensible pipeline that allows you to customize how an object is created”.
    Personally, I didn’t work directly with MS ObjectBuilder but I used it in-direct by working with Web Client Software Factory.


I do recommend starting by reading this tutorial series; it’s using the Castle Windsor to explain how to use and benefit from Inversion of Control.

Pros & Cons of Plugin architecture:


Pros:

  1. Loosely coupled; changing one component will not affect the other running components.

  2. Extensibility; you can add or remove components as much as you need.

  3. Reusability; components and services can be reused as much as you need.


Cons:

  1. Complex, need to train the developers to use it.

  2. It takes a time to setup your initial project and define your policies and procedures.


Conclusion:

It’s very interesting when you can really focus on business from the first day rather than worrying about your application infrastructure, but it’s not easy to accomplish such a target. For applications you need a complete application framework where you can utilize. I would like to recommend two libraries (application framework) were you can start from there:

  1. Spring framework: http://www.springframework.net/

  2. Microsoft Web Client Software Factory: http://msdn.microsoft.com/en-us/library/ff648752.aspx and http://webclientguidance.codeplex.com/.