Skip to content
Robert C. Martin's packages dependency management metrics for Pharo.
Branch: master
Clone or download
Pull request Compare This branch is 5 commits ahead, 2 commits behind luque:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


Build Status Coverage Status

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:

    • Afferent Couplings (Ca): The number of classes outside a given package that depend on classes within that package.
    • Efferent Couplings (Ce): The number of classes inside a given package that depend on classes outside that package.
    • Instability (I): equation
  • Abstraction metrics:

    • Number of classes (Nc): The number of classes in the package.
    • Number of abstract classes (Na): The number of abstract classes in the package. An abstract class is a class with at least one abstract method.
    • Abstractness (A): equation
  • The Main Sequence:

    • Distance to the main sequence (D): equation
    • Normalized distance to the main sequence (D'): equation

Install DMMetrics

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';

To add DMMetrics to your own project's baseline just add this:

    	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.

Getting started

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

Inspector on DMMPackageGroupVisualizations - DM Metrics Tab

Distances to Main Sequence

Inspector on DMMPackageGroupVisualizations - Distances to Main Sequence Tab

Package Dependencies

Inspector on DMMPackageGroupVisualizations - Package Dependencies Tab

Quality Rules

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:

Browser with SDP warnings for a package

You can’t perform that action at this time.