Summary: Find patterns of dependencies in and between bundles of code
Author: Daniel Vainsencher
Owner: Daniel Vainsencher (dvf)
Co-maintainers: <None>
PackageInfo name: MudPie
RSS feed:


Tool for understanding indirect links between code.
Requires Connectors.
If you have trouble, please run the tests first.

Paper for ESUG 2003:
Short description of that presentation:

And something like a tutorial is below:

Start executing these from the top (use print it or explore it):

mma _ MultiModuleAnalyzer onCategoriesWithPrefix: 'FFI'
mma isNonCyclic
mma packageStrongComponents
mma badStrongComponentsIn: mma packageStrongComponents
mma badStrongComponentsIn: mma classStrongComponents "this is no big deal - just 2 classes. And classes that collaborate closely will often know each other, and they're in the same category, so it's a given that they will be loaded/unloaded together"

"The eToys Protocols stuff has some issues - it's categories are not built as hierarchially partitioned layers. This will show pretty quickly."
mma _ MultiModuleAnalyzer onCategoriesWithPrefix: 'Protocols'
mma isNonCyclic
mma packageStrongComponents
mma badStrongComponentsIn: mma packageStrongComponents
MessageSet openMessageList: mma cycleExampleForLargestPackageStrongComponent name: 'Methods/inheritance references that create one bad cycle (might be more)'
CodeAnalyzer clumpinessOfComponents: mma packageStrongComponents

"To see how some more basic infrastructure used, walk through the following.
setup (this will take a minute or two):"

graph _ CodeGraphCreator graphForClassesAndExtensions: Smalltalk allClasses

"The following show one way each class is dependent on the other (there
could be other ways):"

CodeAnalyzer referencePathBetweenClass: MIMEDocument andClass: Object in: graph

"Simple inheritance"

CodeAnalyzer referencePathBetweenClass: Object andClass: MIMEDocument in: graph

"a far less proper dependency..."

CodeAnalyzer referencePathBetweenClass: MIMEDocument andClass: GeeBookMorph in: graph

"You can also find paths between groups of classes (useful to analyze whole categories): "

GraphAnalyzer new shortestPathFrom: {#Object} to: {#MIMEDocument} in: graph

"Components show what groups of classes are interdependent:"

components _ GraphAnalyzer new findStrongComponentsIn: graph

(components detect: [:e | e includes: #VRMLNodeSpec]) size

bigComp _ (components detect: [:e | e includes: #GeeBookMorph])
bigComp size

"that there is the problem."

(components select: [:e | e size 1]) size

CodeAnalyzer clumpinessOfComponents: components

"shows a number summarizing how bad things are. This should be pretty close to 1."

"Another way to define components is that you can find an indirect link between any two node, in both directions. Probably on at least one of those directions you can find a good example of a bad dependency. You can see them using pathBetween:.. as above."

CodeAnalyzer referencePathBetweenClass: (Smalltalk classNamed: bigComp atRandom) andClass: (Smalltalk classNamed: bigComp atRandom) in: graph

"Have fun."

old version comments:
0.51 - Added integrity test interface:
Allows SUnit tests to easily check that the right independencies still obtain. See #testStructure as an example.

0.5 - Lots of helper methods, including simple interface to create Connectors diagrams, and .dot diagrams (for graphviz).

Important bug fix - updated to use PackageInfo's new interface.

0.42 - This version can create cool drawings of the interdependencies between modules, using Ned's Connectors (which need to be loaded).

At the graph analysis level, can convert any graph into the DAG of it's strong components. This shows whatever hierarchial structure the graph has...

0.41 -

0.3 -
It now graphs plain classes, and also graphs classes according to packages. Initial implementation of graphing Packages also done, though not well tested.