[[Property:title|Units]] [[Property:weight|2]] [[Property:uuid|fa08d5aa-7ea4-e7bb-bb59-e4982a583976]] Metrics will be expressed in units, such as Line (numbers of source lines) or Feature (number of features). {{rule|name=Unit rule|text=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: {{definition|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: {| |- | '''Unit''' | '''Quantities measured''' | '''Kind''' |- | Class | Number of classes or types | Product |- | Generic | Number of class generics | Product |- | Feature | Number of features | Product |- | Target | Number of targets | Product |- | Group | Number of groups | Product |- | Assertion | Number of assertion clauses | Product |- | Argument | Number of arguments of a routine | Product |- | Local | Number of locals of a routine | Product |- | Line | Number of source lines | Product |- | Compilation | Number of compilations | Process |- | Ratio | Results 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" can all be expressed simply as ratio. ==Code Element== For most of units, an item of that unit represents a code element in a real system. For example, an item of class unit represents a class and an item of line unit represents a line of code. All supported code elements are listed as follows: {| |- | '''Code Element''' | '''Unit''' | '''Description''' |- | Class | Class | Represents a class |- | Generic | Generic | Represents the piece of the code related to generics definition in a class definition. |- | Feature | Feature | A feature or an invariant clause. In metrics tool, a feature can be one of two things: a traditional feature, or an invariant clause. That is to say, an invariant clause is treated as a special feature. To avoid ambiguity, we call a traditional feature a "feature" and an invariant clause an "invariant feature". |- | Target | Target | Represents a target |- | Group | Group | Represents a group in system. A group can be either a cluster, a library or an assembly |- | Assertion | Assertion | Represents an assertion |- | Argument | Argument | Represents a formal argument in features |- | Local | Local | Represents a local defined in features |- | Line | Line | Represents a line of code |- | Folder | - | Represents a physical concept to store classes. The semantic of a folder in metrics tool is equal to a list all classes which are located in that folder (not recursively). So a folder item doesn't provide new functionality, it just facilitates the operation to select a set of classes. |- | Delayed item | - | A delayed item is a place holder, it will be replaced by the candidate code element over which a domain criterion is evaluated |- | Input domain item | - | An input domain item is a place holder, it will be replaced by the domain selected as input to the metric. In the case that the input domain is presents in a basic metric definition, when that metric is calculated, the metric will use the current application target as the input domain. |- | Current application item | Target | Represents the application target of the current Eiffel system |}