As an extension to
Analyzing Java With Moose, in this post I will show how one can create a Design Structure Matrix (DSM) in Moose, in particular from a model of a Java project.
First, you need to generate and load an MSE file into Moose for a Java project. Refer to this post for those steps, which uses the Java code from from Head First Design Patterns.
Roassal (which is a visualization platform that’s part of Moose) has a visualization for DSM called RTDSM. It’s explained here, but with Pharo classes. How to use it with Moose on a Java model?
The key is in the
dependency: block, which we define using a Moose Query with
Open a Moose Playground and paste the following Pharo code:
| dsm classes | dsm := RTDSM new. classes := (MooseModel root first allModelClasses select: [ :c | c mooseName beginsWith: 'headfirst::designpatterns::combining::decorator' ]) reject: #isAnonymousClass. "Avoid arbitrary ordering by sorting" dsm objects: (classes asSortedCollection: [ :a :b | a name < b name]). "Change the default label from asString which is very long" dsm labelShapeX label text: #name. dsm labelShapeY label text: #name. "Moose Query equivalent to #dependentClasses for a Pharo class" dsm dependency: #allClients. dsm rotation: 270. ^dsm
This visualization may not be as powerful as IDEA’s DSM analysis or Lattix’s, but it’s open source and can be manipulated in Pharo.
In Moose Query, the opposite to