A lot of software is made in such a way that it allows for extensions or plugins. It is now incorporated in such a way that even many games allow mods being installed. Creating software that allows for such extensions is a challenging endeavor, it will determine the boundaries of an extension can do. Two important things need to be created:
- The mechanism that allows the base platform to detect the plugins.
- An interface such that the base platform and the plugin can communicate.
Scriptura Engage, the product I work on, is based on the Eclipse base platform. It uses both the Eclipse extension points and OSGi mechanism, which is incorporated into eclipse (also known as equinox).
Eclipse works with plugins out of the box, and installing new plugins comes at no cost. Plugins can contribute like that and act as a pure extension, which requires no interaction with the rest of the platform, or they can extend an extension point which allows the platform to find them. The extensions added through the extension point are usually smaller and offer only a small new feature.
Not all is well with this mechanism though. It turns out that testing OSGi related things is hard as most testing frameworks can not handle this. Moreover it tends to cut up all your code in many small projects, which makes it hard to manage everything. It becomes even worse if you want to group plugins together into a feature. This requires a different project to be created with nothing more than an enumeration of all the plugins that contribute to it.
At the same time a lot of the structural complexity is caused by ourselves. If every single addition is considered as a different plugin it is obvious you end up with hundreds of plugins, mostly consisting of only 1 or 2 java files. In my opinion this is bad design, as related functionality should be grouped together. We are limited by Eclipse in this, but I believe it would be much better if we could specify multiple plugins in each project, by selecting the code or packages that should be included into the plugin.
This does not only reduces the amount of projects we have to maintain, it also allows us to be more selective in what we expose. We can achieve a higher form of re-usability and readability.