The birds lake

Foreword : extensible systems

Time where applications were big monolythic blocks has gone. Now the most usefull applications are evolutives

Plugins

A first approach to solve the need of evolubility consists in cutting an application in different subsystems, and to define contracts that these subsystems should respect. We can then choose one particular subsystem from many which all respect the same contract.

Adding the capabily of loading a library at run-time, we obtain kernel-plugins architectures. For example : xmms is an application for listenning audio sound tracks. Different contracts have been defined :

A plugin is put in the same folder as those who respect the same interface as it. For example the following code show the registering of the Input plugin 'mad' in xmms kernel. Xmms core ask a reference to the symbol get_iplugin_info, execute it and save the result in it's table.
/**
* XMMS input plugin hook.
*/
InputPlugin *
get_iplugin_info (void)
{
    memset (&mad_plugin, 0, sizeof (InputPlugin));
    mad_plugin.description   = DESCRIPTION " " VERSION;
    mad_plugin.about         = xmmsmad_about;
    mad_plugin.init          = xmmsmad_init;
    mad_plugin.set_eq        = xmmsmad_set_eq;
    mad_plugin.configure     = xmmsmad_configure;
    mad_plugin.is_our_file   = xmmsmad_is_our_file;
    mad_plugin.play_file     = xmmsmad_play_file;
    mad_plugin.stop          = xmmsmad_stop;
    mad_plugin.pause         = xmmsmad_pause;
    mad_plugin.seek          = xmmsmad_seek;
    mad_plugin.get_time      = xmmsmad_get_time;
    mad_plugin.get_song_info = xmmsmad_get_song_info;
    mad_plugin.file_info_box = xmmsmad_get_file_info;
    mad_plugin.cleanup       = xmmsmad_cleanup;

    return &mad_plugin;
}
		

Extension langage

Other idea : bind the application with an extension langage and allow so the user to create it's own extensions. The extension langage is a scripting langage (no needs to compile) and access to the application data structures that the programmer wants to export in a secured way (Exception handling, garbage collection and no handly made memory allocation).

The mail client mutt use such extension langage for it's initialisation file but also during run-time.

set pop_host="pop.xxxx.fr"
set pop_user="michel.strasser"
set pop_pass="secret"
set pop_delete="yes"
set from="Michel Strasser <myEmail@myProvider.fr>"

#copie et sauvegarde

set copy=yes
set record="=outbox"

color signature magenta default

# spamassassin classify as spam
macro index Y "|/usr/bin/spamc -r"
# spamassassin classify as ham
macro index H "|/usr/bin/sa-learn --ham  --no-rebuild --single"
# spamassassin report and classify as spam
macro index S "|/usr/bin/sa-learn --spam  --no-rebuild --single"
# rebuild the spamassassin bayes filter db
macro index E "!/usr/bin/sa-learn --rebuild"

The history has shown us that we have to be vigilant. For example the possibility to to embend code in document was not such a great idea. Think macro-viruses, in the tuple {'Visual Basic', 'Word'}...

More improvements

Extensible systems became more and more sophisticated :