Online Eiffel Documentation
EiffelStudio

Units

Metrics will be expressed in units, such as Line (numbers of source lines) or Feature (number of features).

Unit rule: The definition of any metric must specify an associated unit.

Different metrics may be marked with the same unit; for example metrics such as number of non-comment lines and number of comment lines may both be marked with the unit Line.

Whenever we need to express ratios of one measurement to another, as in computing the average number of features per class by dividing the number of features by the number of classes, we will use a specific unit, Ratio:

"Ratio unit": The name Ratio denotes a predefined unit, whose values are arbitrary real numbers, expressed either as numbers or in percentage style (as in 35.3%).

As a result of this choice, we will consider every division to yield a result of unit, Ratio.

The following predefined units are available in the metric tool:

UnitQuantities measuredKind
ClassNumber of classes or types Product
FeatureNumber of features Product
TargetNumber of targetsProduct
GroupNumber of groupsProduct
AssertionNumber of assertion clausesProduct
ArgumentNumber of arguments of a routineProduct
LocalNumber of locals of a routineProduct
LineNumber of source lines Product
CompilationNumber of compilations Process
RatioResults of divisions Product

The units listed here are minimal in the sense that it is not possible to add the properties measured by any two of them; for example it makes no sense to add a number of features to a number of classes.

In the future, it might be desirable to include more specific units, such as "features per class" , and an associated calculus of units (as in the physical sciences, where multiplying a quantity expressed in g /cm by one in cm yields a result in g). This has not appeared necessary for the typical uses of division envisioned in this note, answering such questions as "What percentage of routines have a header comment" and all expressed as simply as Ratio.