Moose demo: browsing class naming cohesion

A previous post demonstrated how to build a simple visualization to explore the overall class name cohesion. In that case, the visualization showed a picture of how classes that have similar names are also placed in the same package.

The result was a global view that was applicable to all classes. But, what if we want to get the naming cohesion of classes on a per package basis? Simple, we need a browser that enables us to explore the packages in the system, and for each of these to show the visualization. And, as we do not have it yet, we have to build one.

Take a look.

The code for the browser can be seen below.

composer tabulator with: [:t |
  t column: #namespaces; column: #classes.
  t transmit to: #namespaces; andShow: [:a |
    a tree
    display: [:mooseModel | mooseModel allNamespaces select: #isRoot ];
    format: #name;
    children: #childScopes ].
  t transmit from: #namespaces; to: #classes; andShow: [:a |
    a mondrian
      painting: [:view :namespace |
        view shape rectangle
          size: #nameLength.
        view nodes: namespace classes.
        view edgesToAll: [ :class |
          namespace classes select: [ :eachTarget |
            (eachTarget name pairsDistanceFrom: class name) > 0.5]].
        view graphvizLayout neato ]]].
composer startOn: model
Posted by Tudor Girba at 26 March 2012, 12:48 am with tags moose, demo, tooling link
|