design-patternspluggable

Are configuration files and pluggable code both answers for a plugin architecture?


I keep thinking. Okay, I understand why I want pluggable (or at least the concept of extending, giving extra life/functionality to my program.) I also understand how it works with code, how to do it.

What I don't understand is why I wouldn't use xml files or some other configuation file? Is it possible to create your "pluggable" architecture or extend life to your application by using configuration files? Does that make your application pluggable?

Or, does pluggable solely mean an application where you can write code to extend the application?

Does it just depend on what I need for my application?


Solution

  • There are several levels of "pluggability" I guess.

    For example, the java eclipse IDE is built in a pluggable architecture where you can download libraries and add to a running platform without the need to restart it. This means some dynamic classloading hell using OSGi.

    On the other side, you may have some simple app that delegates some functionality to some simple DSL scripts that you can add/edit/remove to your system during execution and this may be quite effective and relatively easy to implement.

    Being pluggable can be a strategy, like you're providing a platform where you can add some 3rd party components to enhance it in ways you simply could not do yourself, like Firefox and Chrome does.

    I think of "plugin" like a "feature extension" of a platform. If your platform is eclipse, firefox, jenkins, (your application) it's up to you.