Moose demo: exploring class naming cohesion

There are always multiple ways to look at a given situation. When it comes to data, the more versatile the infrastructure, the more you have a chance to actually do take a look at it from multiple points of view.

In this demo we take a look at how cohesive are the names of classes. The question is how can we identify possible misplacements or wrong names:

  • on the one hand, classes with similar names should denote similar concepts,
  • on the other hand, classes placed in the same namespace should work together.

Thus, an interesting experiment consists of relating the similarity of class names with the namespaces they reside in. To achieve this we cluster visually the classes based on the similarity of their names, and then we color each class with a unique color based on the identity of the parent namespace.

This is a short analysis exercise. The goal is one of exploration, of playing with the system to learn from it. Watch it below.

Here is the code of the visualization:

view shape rectangle
    size: #nameLength;
    identityFillColorOf: #namespaceScope.
view nodes: classGroup.
view edgesToAll: [ :class |
    classGroup select: [ :eachTarget |
        (eachTarget name pairsDistanceFrom: class name) > 0.5]].
view graphvizLayout neato
Posted by Tudor Girba at 13 July 2011, 8:12 am with tags moose, demo, tooling link
|