8684
« Last post by mouser on October 14, 2013, 09:56 AM »
Mewlo Web Framework Blog Entry #4 - October 14, 2013 - A First-class Addon/Plugin/Extension System
At the end of my last Mewlo blog entry I talked about the central role of an addon/plugin/extension system in Mewlo, and the idea that it would be a natural first structure to start coding.
There are very good reasons to start with an addon/plugin/extension system. First and foremost because it makes it easier for other coders to start independently writing drop-in code packages, and makes it easier to keep these updated and integrated. But I think another key benefit is that it brings into sharp relief early in development the need to craft an API to interact with the rest of the system. The earlier we force ourselves to view the system as an API, the better.
What exactly should the addon/plugin/extension system for a web framework do? What features does it need to have?
Let's start by restating briefly the main goal of a (web) framework. The goal is to provide a base upon which custom coding can be done. A framework enables coders to avoid re-writing the same structures and code for each new project, and provides a well-organized and easy-to-maintain structure that can be extended.
So it should come as no surprise that all non-trivial frameworks have facilities for adding and integrating 3rd party extensions.
For web frameworks, we can distinguish two aspects of how such extensions work:
First, we can look at the actual API provided for interacting with extensions, and how they communicate with the rest of the framework. Here we find generally quite robust implementations.
Generally one sees a signaling system, where components can register to receive signals when certain events occur, and can register their own signals that listeners can subscribe to. A signaling system is a key way to let modules interact without requiring them to know too much about each other.
One also often sees a kind of component "registry", where extensions can add new objects that can be used by other code, or new functions that can be called, or where extensions can replace existing components.
However, while the internal API for facilitating interactions between extensions and the core system is often robust and clean, web frameworks generally provide only the most rudimentary higher-level maintenance support for managing extensions.
What exactly do I mean by "higher-level maintenance support for managing extensions"?
If we take a look at software that is one-level higher-up and removed from a web framework, like a Content Management System (CMS) or a blog, what we often see is quite elaborate support system for maintaining extensions.
Such a support system can include an administrative backend that can provide information about current installed extensions and their version and status, and a button to click to check for extension updates online. The online update check can be as full-featured as a desktop update check tool, providing information about new versions available -- the changes and release dates, etc. The system may also support dependency checking between multiple modules, and report on incompatibilities and dependencies between extensions. The administration system may even support searching for extensions online, and then automatically downloading and installing (or uninstalling).
In one aspect, extension updates/installs/uninstalls for online web services are more complicated then desktop applications, and that is when the database needs to be substantially altered. Whether one is installing, updating, or uninstalling, the need to perform database upgrades can be tricky (especially for a live system). Frequently one may want to save a database backup to be able to roll-back a problematic update, and one may need to take the system offline while updating.
I take the position that such functionality is exactly the kind of thing that a framework should do more to assist: It is common functionality found in most modern web applications, represents a substantial amount of coding, is hard to code properly and is hard to maintain. This is especially true for the situations where an extension update needs to perform some one time database updates. In short, this is an areas that a web framework should do much more to assist with -- building a web application should not require the coder to reinvent the wheel when it comes to supporting extensions. And yet it is an area that few (any?) web frameworks support robustly.
The support for such extension management and updating is a good example of how Mewlo is trying to occupy a middle ground between traditional web frameworks and higher level content management systems. In some ways you might say that Mewlo is more of a Content Management System Construction Kit.