A spike assessment story: Resolving odd dependencies in Moose

This story was contributed by Alexandre Bergel.

Some of the Moose users discovered some odd dependencies in the core of Moose. A basic software maintenance principle is to properly isolate user interface concerns. More specifically, some algorithm packages had wrong dependencies to the Roassal visualization project.

Identifying the problematic methods inducing odd dependencies is not straightforward with default tools. To fix the problem I used the available Moose tools as described below:

Step 1. I've open a Moose panel, imported all the packages that match *Algo* and *Roassal-* since a brief description of the problems seems to have some dependencies going from Algo to Roassal.

Step 2. I opened a Roassal Easel on the model packages and constructed the following script:

| ps moosePaks roassalPaks lbl |
"We separate the packages that belongs to Moose from the one of Roassal"
ps := packageGroup select: [ :p | p name beginsWith: 'Moose' ].
moosePaks := view node: 'Moose' forIt: [
 view shape rectangle size: #numberOfClasses.
 view interaction action: #inspect.
 view nodes: ps ].
"For aesthetic purpose, we insert a label next to the visualization"
ROConstraint stick: (lbl := (ROLabel text: 'Moose') element) onTheRightOf: moosePaks.
view raw add: lbl.

roassalPaks := view node: 'Roassal' forIt: [
 view shape rectangle size: #numberOfClasses.
 view nodes: (packageGroup select: [ :p | p name beginsWith: 'Roassal' ]) ].
ROConstraint stick: (lbl := (ROLabel text: 'Roassal') element) onTheRightOf: roassalPaks.
view raw add: lbl.

view shape bezierLine color: Color red.
view interaction 
 item: 'browse' 
 action: [ :assoc | (assoc key methods select: [ :m | 
  m querySureOutgoingInvocations atPackageScope includes: assoc value ])
  inspect ].
view edges: ps from: #yourself
 toAll: [ :p | p querySureOutgoingInvocations atPackageScope ].
view verticalLineLayout center verticalGap: 100.

I obtained a picture highlighting the problem as in the following screenshot:

Right clicking on a line gave me the list of culprit methods. This view was handy to identify odd dependencies.

Step 3. Once I knew what was wrong, I had manually repackaged the culprit methods using the system browser. For examples, some methods deserved to be move in some of the Roassal packages.

Step 4. I imported again the new version of the packages, run the visualization and I get:

Step 5. Again, I have inspected each edge, and fixed the problem. The final visualization revealed a cleaner situation:

Problem solved!

Posted by Alexandre Bergel at 30 September 2013, 7:30 am with tags spike, story, moose, assessment link
|