Beautiful Software: Colony Framework
Colony Framework is an open source plugin framework. It's a language independent spec, that's currently well implemented in Python (perfect on CPython, last time I checked also worked on IronPython and Jython). But there is also a full-blown implementation in JavaScript and an initial Ruby port.
What is it for?
It makes your applications modular, by making you think in components rather than objects. That makes you have to follow a series of object-oriented design principles (encapsulating what varies, favoring composition, achieving loosely couple designs), whether or not you like it... Which is good for you, trust me.
So what?
These concepts are not new. You can build a plugin-like infrastructure for your app from scratch and software exists to let you add bits of pluggable modularity to an existing application. There are even similar modularity frameworks than can help you build your whole application as a set of modules
The way I see it, it's all about the price you pay to get that modularity, and what you get in return (extras are always welcome).
What do you get?
It's not a coincidence that the first implementations are for interpreted, dynamically typed languages. The design philosophy behind Colony is about simplifying modularity, and it does a decent job of keeping the overhead low.
That means cutting down on the wrapping metadata you need to declare a plugin. It also means using IoC extensively to let things come to you, instead of having each plugin have to look and ask for all the tools it needs to work.
You also get a growing set of components you can use in your applications and can probably save you time and money.
On top of that, there's this ambitious vision of viral distribution. This means plugging a new colony instance to an existing colony grid is as easy as setting up an OS, the VM for your implementation language of choice and the colony manager along with a base set of distribution plugins. After that, the instance uses Zeroconf-like techniques to be aware of its surroundings and starts interacting with the grid, becoming an active participant in it. New plugins and any required computation can then be transparently offloaded to, or shared with, the new instance according to its computing abilities.
For instance...
You probably just need to get these 3 concepts:
- Plugin: the component itself, it provides a façade for the behaviour it encapsulates, as well as all the resources it might need to operate.
- Dependency: plugins may present an explicit request for another plugin id+version combination in order to function. The plugin manager will then take care of injecting a reference to the dependency.
- Capability: plugins may also indicate they can have their functionality extended by other plugins that conform to a specific interface (capability). This way is not about a specific plugin, but rather about a given contract... which means the plugin can be extended in innovative ways, as long as the API contract is kept.
Short and sweet example: imagine you have a basic instant messaging plugin, which depends on some plugins that offer services to display and retrieve information to and from the user, and then allow some instant messaging protocol capability. When the plugin loads, it will receive the I/O plugins it depends, but it will also get all the available instant messaging protocol plugins, allowing the user to communicate through as many IM protocols as there are IM protocol plugins available in the Colony instance.
Learn more?
You can visit the official website, follow the project on Twitter, check out the docs, subscribe to the mailing list or hangout at #colonyframework on freenode.
(disclaimer: I'm a commiter on the Colony Framework project and I own shares of Hive Solutions who sponsors development)
