An Example

To demonstrate that CORBA could be used as a tool for scripting an application, I started with my window manager of choice, lwm. Choosing an application that I was using regularly had the advantage of providing both immediate testing and utility. The resulting window manager and some sample clients are available for download.

lwm is a lightweight window manager, offering little more than basic window management and few configuration options. There are few objects to export, just windows, screens and the manager. Screens and the manager are primarily used to find window objects. Window objects provide methods on windows - specifically, anything that the user can do with the mouse, a script can do via the window objects.

The clients included in the package are written in C, Python and Eiffel. One is a simple desktop manager, which allows users to save window configurations with a name - a desktop - and switch between desktops. Many window managers offer such a facility, but this one is external to the window manager, and only resides in memory when the user is changing or listing desktops.

More interesting is the tile client, which lets the user select a subset of the active windows and move them into non-overlapping tiles on the screen. No window manager I know of provides this facility. Some of the window managers with embedded scripting languages might be able to do this, if they allow user manipulation of the windows.

The effort of adding the scripting extensions is about the same as adding an embedded scripting language. Both require learning the interface for the extensions and writing the code required to wrap the objects which are being made available to the scripting language. The CORBA mechanisms also require learning enough IDL to describe the objects. There may or may not be a similar requirement for an embedded scripting language, depending on the method chosen to export them. On the other hand, the CORBA library handles the translation between C and CORBA types transparently, with no need to learn the macros or functions for type translation required by some embeddable interpreters.

Comparing the memory footprint is difficult, as what you are measuring varies depending on the language being embedded, the CORBA library used, the platform being used, and how various parts of the code are shared. The sum of the sizes of the CORBA shared libraries and the growth in size of the executable are roughly half the size of the executable and language-specific shared libraries for the scripting languages Perl, Python or Guile, so it's safe to say that the footprint is no larger than the footprint for an embedded language.

On to the Summary, up to the contents, or back to the UNIX environment.

Comments