Time where applications were big monolythic blocks has gone. Now the most usefull applications are evolutives
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 :
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; }
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'}...
Extensible systems became more and more sophisticated :
<?xml version="1.0"?> <oaf_info> <oaf_server iid="OAFIID:GNOME_AbiWord_ControlFactory" type="exe" location="AbiWord-2.0"> <oaf_attribute name="repo_ids" type="stringv"> <item value="IDL:Bonobo/GenericFactory:1.0"/> </oaf_attribute> <oaf_attribute name="name" type="string" value="AbiWord Viewer Factory"/> <oaf_attribute name="description" type="string" value="AbiWord Viewer Factory"/> </oaf_server> <oaf_server iid="OAFIID:GNOME_AbiWord_Control" type="factory" location="OAFIID:GNOME_AbiWord_ControlFactory"> <oaf_attribute name="name" type="string" value="AbiWord Viewer"/> <oaf_attribute name="description" type="string" value="Word Processor Viewer"/> <oaf_attribute name="repo_ids" type="stringv"> <item value="IDL:Bonobo/Control:1.0"/> <item value="IDL:Bonobo/Embeddable:1.0"/> <item value="IDL:Bonobo/Persist:1.0"/> <item value="IDL:Bonobo/PersistFile:1.0"/> <item value="IDL:Bonobo/PersistStream:1.0"/> <item value="IDL:Bonobo/Print:1.0"/> <item value="IDL:Bonobo/PropertyBag:1.0"/> <item value="IDL:Bonobo/Unknown:1.0"/> <item value="IDL:Bonobo/Zoomable:1.0"/> </oaf_attribute> <oaf_attribute name="bonobo:editable" type="boolean" value="true"/> <oaf_attribute name="bonobo:supported_mime_types" type="stringv"> <item value="application/x-abiword"/> <item value="application/msword"/> <item value="application/rtf"/> <item value="application/wordperfect5.1"/> <item value="application/x-applix-word"/> <item value="application/vnd.palm"/> <item value="application/x-palm-database"/> <item value="text/abiword"/> <item value="text/plain"/> <item value="text/richtext"/> <item value="text/rtf"/> <item value="text/vnd.wap.wml"/> <item value="text/*"/> </oaf_attribute> <oaf_attribute name="nautilus:view_as_name" type="string" value="Word Processor"/> </oaf_server> </oaf_info>