Plugin Architecture in Web Apps (Examples or Code Snippets?)

A good plugin architecture is difficult to achieve from scratch, but offers its own rewards. It makes the software flexible and simple to maintain by localising complexity. The foremost skill it requires is the ability to write loosely coupled code. This demands a very firm grasp of polymorphism, Demeter’s Law and the related Hollywood principle.

I recommend that you initially gain a good familiarity with those, then the following design patterns, which will reduce the difficult significantly :

  • Command Pattern : Gives Plugin Modules a consistent entry point, allowing them to be readily swapped in and out, a Web Based example from IBM.
  • Memento : Capture, hold and externalise state without violating encapsulation, allows plugins to be configured by the container.
  • Call Back : Allows the Plugin Modules to access ‘services’ from the container/environment.
  • Dependency Injection : A way to loosen the coupling of Plugin Modules from their environment.
  • Abstract Factory Pattern : Installing and instantiating the Plugin in the environment.
  • Builder Pattern : Required for any non trivial plugin architecture where Plugin Modules are dependent on each other.

Once you grasp those, study some of the existing Plugin Framework implementations and architectures to see how they’ve been used. Apache have several in Struts, Geronimo custom server assemblies and Tomcat JNDI Resources; Also the Eclipse plugin framework.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)