on Software

Module Dependencies

26 Feb 2015

A Smallworld™ installation consists of products which themselves are made of modules. The module system allows the specification of module dependencies, regardless of the product containing the required module. New users to the system can easily feel overwhelmed by the number of available modules. So let’s see what the modules look like from 30k feet.

The structure of a module.def file - for our purposes - is outlined below.

module_name version

	description text here

	other_module_a version
	other_module_b version

A Parser

It is not hard to write a parser for this format. The parser in the magik-module-dependencies repository is written in Groovy. It outputs the modules and their interdependencies as JSON. The script takes as arguments the directory names in which to search for files. The generated output of the core product modules of a Smallworld™ 4.3 start with the following lines:

var acefael = acefael || {}
acefael.nodes= [{"file":"sw_core/modules/sw_dev_tools/system_monitor/module.def" ,
                 "description":"Front end dialog for system monitoring tool",
                 "description":"Front end for the coverage analyser",
                 "requires":[["coverage_analyser","1"]],"index":1}, ... ]

Each node Javascript-Object contains the module.def filename relative to the scanned directory, module version and description, an artificial index that is used to describe the links in acefael.links and last but not least the module requires. From the requires the Groovy script builds acefael.links.

But what to do with that?

I had my share of fun drawing graphs using d3. The result is shown in the picture below.

You can hover over a node to see a tooltip with the name and version. Hovering also paints modules depending on me in orange and modules I depend become blue.

Interactivity and your own Graph

To see your own module graph checkout the magik-module-dependencies repository. To start off with the graph above run the following:

git checkout
cd magik-module-dependencies
python -m SimpleHTTPServer &

Then point your browser to

It gets really interesting when you generate the graph for your own modules. This can be done by running the acefael-sw-mod-deps.groovy script. The output should be redirected to acefael-sw-mod-deps-data.js. It takes as parameters the names of directories to scan. An example:

CLASSPATH=.../groovy-all-2.4.1-indy.jar \
  java groovy.lang.GroovyShell \
     acefael-sw-mod-deps.groovy \
       gis430/product gis430/cambridge_db \
       < acefael-sw-mod-deps-data.js


Another graph could potentially be generated using the CodeFlower tool. This builds on d3 as well, but looks admittedly a lot better.