DMMetrics is a library to compute Robert C. Martin's dependency management metrics for packages in Pharo.
DMMetrics is written and supported by Rafael Luque and other developers at OSOCO.
DMMetrics computes the following metrics for your Smalltalk packages:
-
Stability metrics:
-
Abstraction metrics:
-
The Main Sequence:
To install DMMetrics on your Pharo image you can just execute the following script:
Metacello new
githubUser: 'luque' project: 'dm-metrics' commitish: 'master' path: 'src';
baseline: 'DMMetrics';
load
To add DMMetrics to your own project's baseline just add this:
spec
baseline: 'DMMetrics'
with: [ spec repository: 'github://luque/dm-metrics:master/src' ]
Note that you can replace the #master by another branch as #development or a tag.
To compute the dependency metrics for a collection of packages you can execute the following in a Playground:
packages := RPackageOrganizer default packages select: [:p | 'ProfStef*' match: p name].
(DMMPackageGroupVisualizations onPackages: packages) build open
This code will show you an inspector on the DMMPackageGroupVisualizations
with the following tabs:
DM Metrics
Distances to Main Sequence
Package Dependencies
DMMetrics also includes Renraku rules and critiques in order to check violations of the Stable-Dependencies Principle (SDP):
The dependencies between packages should be in the direction of the stability of the packages. A package should only depend upon packages that are more stable than it is.
If you select a package in your browser tool, the potential SDP violations will be shown by the Quality Assistant (the lower panel) as warnings, like in the following example: