| Prev - Next - Down | SDMetrics - the UML design measurement tool |
As an example for an application of the compare procedure in the context of rules, we consider the Stable Dependencies Principle (SDP) [Mar03]. The SDP says that the instability (ratio of efferent couplings to total couplings) of a package should be larger than the instability of the packages that it depends on. Assume we already have defined the instability metric I for packages, and the set DepPackages of packages that a given package depends on. We can then define a rule reporting violations of the SDP as follows:
<rule name="SDP" domain="package" category="Style" severity="2-med"> <description>Stable dependencies principle: Instability of a package should be larger than that of the packages it depends on.</description> <compare term="I" set="DepPackages" with="I" comp="term<with" value="qualifiedname(self)" /> </rule>This compares the value of the I metric for the current package to the I values of the packages in DepPackages, reporting all packages with larger values.
In the context of rules, the report_element attribute is not allowed, and the compare procedure supports two additional attributes:
| Prev | Up | Next |
| Section 8.3.4 "Valueset for Rules" | Contents | Section 8.3.6 "Word lists" |