Software Metrics The measurement of a particular characteristic of a software program's performance...

21

Transcript of Software Metrics The measurement of a particular characteristic of a software program's performance...

Software Metrics

The measurement of a particular characteristic of a software program's performance or efficiency. (http://www.bitpipe.com/tlist/Software-Metrics.html).

Software Metrics

Software metrics is a collective term used to describe the very wide range of activities concerned with measurement in software engineering.

These activities range from producing numbers that characterize properties of software code (these are the classic software ‘metrics’) through to models that help predict software resource requirements and software quality. (http://www.dcs.qmw.ac.uk/~norman/papers/metrics_roadmap.pdf).

Software Metrics

The history of software metrics dates back to the mid-1960’s when the Lines of Code metric was used as the basis for measuring programming productivity and effort.

•The first dedicated book on software metrics was not published until 1976.

Validation

Validation of a software metric is the process of ensuring that the metric is a proper numerical characterization of the claimed attribute.

• A software metric is only valid if it can be shown to be an accurate predictor of some software attribute of general interest like cost or reliability.

Software Metrics

The following are criteria for valid metrics:

1. A metric must allow different entities to 1. A metric must allow different entities to be distinguished.be distinguished.

2. A metric must obey a representation 2. A metric must obey a representation condition.condition.

A A representation conditionrepresentation condition is the is the condition that the rules assigning the condition that the rules assigning the metric properly characterizes the attribute metric properly characterizes the attribute measured.measured.

Software Metrics

3. Each unit of the attribute must contribute an equivalent amount to the metric.

For example, if we are counting lines of For example, if we are counting lines of code, the attribute would be “lines of code, the attribute would be “lines of code” and we do not give different weights code” and we do not give different weights to different lines of code. Each line counts to different lines of code. Each line counts “one”.“one”.

Software Metrics

4. Different entities can have the same attribute values.

For example, horses and people both have For example, horses and people both have the attribute “height” which can be the attribute “height” which can be “measured” using a “metric”. “measured” using a “metric”.

Software Metrics

Many times the attribute of interest is not directly measurable.

In this case an indirect measure is used.

• For example, you can’t directly measure For example, you can’t directly measure the temperature on the surface of the sun, the temperature on the surface of the sun, so an indirect measure is used.so an indirect measure is used.

Software Metrics

An indirect measure involves a measure and a prediction formula.

• For example, you cannot calculate For example, you cannot calculate density directly. First you measure density directly. First you measure mass and volume, then you can mass and volume, then you can calculate density=Mass/Volume.calculate density=Mass/Volume.

Software Metrics

In computer science, many of the “ilities” cannot be measured directly. These include:

• maintainabilitmaintainabilityy• readabilityreadability

• testabilitytestability

• qualityquality(not a true “ility”)(not a true “ility”)

• reusabilityreusability

• complexitycomplexity(another (another

non-“ility”)non-“ility”)

Software Metrics The following are criteria for valid

indirect metrics:• The model must be explicitly defined.The model must be explicitly defined.

What in the world is a “explicitly defined”?

For example, the model for density is For example, the model for density is described by the equation d = m/v. Since described by the equation d = m/v. Since both mass and volume are directly both mass and volume are directly measurable, density is explicitly defined.measurable, density is explicitly defined.

Software Metrics

2. The model must be dimensionally consistent.

For example, if you For example, if you wanted to measure wanted to measure distance using distance using velocity and time (d velocity and time (d = v*t), you would not = v*t), you would not want velocity to be want velocity to be measured in ft/sec measured in ft/sec and time to be and time to be measured in hours.measured in hours.

Software Metrics

3. There should be no unexpected discontinuities.

For example, using the following For example, using the following formula to measure “doodles”:formula to measure “doodles”:

Doodle metric = LOC / (LOC – 10)Doodle metric = LOC / (LOC – 10)

This metric would cause an This metric would cause an unexpected discontinuity at 10 lines unexpected discontinuity at 10 lines of code.of code.

Software Metrics

4. Units and scale types must be correct.

For example, you would not measure For example, you would not measure height in pounds or weight in inches.height in pounds or weight in inches.

Monotonicity

A metric is monotonic if it is a non-decreasing function of the attribute(s).

• For example, what For example, what this means for lines this means for lines of code is that as of code is that as the size of the the size of the program increases, program increases, the number of lines the number of lines of code increases. of code increases.

Measurement Scales

Measurement scales are “types” of data used in analysis.

• There are five types of data:There are five types of data:

1. Nominal – symbols without any order.1. Nominal – symbols without any order.

For example, social security numbers.

Measurement Scales

2. Ordinal data – can be ordered, but no arithmetic.

Example: ranking things like who can play Example: ranking things like who can play basketball betterbasketball better

3. Interval data – the difference makes 3. Interval data – the difference makes sense.sense.

Example: temperatureExample: temperature

Measurement Scales

4. Ratio data – the ratio of two data items makes sense.

For example, temperature measured in For example, temperature measured in Fahrenheit is not ratio data. 64 degrees Fahrenheit is not ratio data. 64 degrees Fahrenheit is not twice as hot as 32 Fahrenheit is not twice as hot as 32 degrees Fahrenheit.degrees Fahrenheit.Height and weight are ratio data.Height and weight are ratio data.

Measurement Scales

5. Absolute data – can be counted (discrete) and the ratio, difference, and ordering all make sense.

Example: Example:

One BILLION dollars

What statistics make sense

Nominal – mode, median, percentiles

• Ordinal – rank measuresOrdinal – rank measures

• Interval – standard deviation, Interval – standard deviation, correlationcorrelation• Ratio – all statsRatio – all stats

• Absolute – all statsAbsolute – all stats