13 Metrics

Embed Size (px)

Citation preview

  • 7/28/2019 13 Metrics

    1/20

    Metrics

    "A science is as mature

    as its measurement tools."

    -- Louis Pasteur

  • 7/28/2019 13 Metrics

    2/20

    Starter Quest ions

    What can we measure?

    What value can those

    numbers have?

  • 7/28/2019 13 Metrics

    3/20

    Why Measure?

    accurate estimation

    how productive are we

    quality improvement

    what do we do well

    what do we do poorly

  • 7/28/2019 13 Metrics

    4/20

    Types of Metrics

    Product Metrics

    direct measures - number of bugs, LOC

    indirect measures - usability, maintainability

    Project and Process Metrics

    direct measures - costs, LOC per month

    indirect measures - quality assurance, reliability

  • 7/28/2019 13 Metrics

    5/20

    Code Metrics

    Size Lines of Code

    Function Points

    Efficiency BigO

    Complexity Cyclomatic Complexity Halstead's complexity metrics (next slide)

    Maintainability

  • 7/28/2019 13 Metrics

    6/20

    Halstead's Complexity Metrics

    n1 = the number of distinct operators

    n2 = the number of distinct operands

    N1 = the total number of operators

    N2 = the total number of operands

    Program length N = N1 + N2

    Program vocabulary n = n1 + n2

    Volume V = N * (LOG2 n)Difficulty D = (n1 / 2) * (N2 / n2)

    Effort E = D * V

  • 7/28/2019 13 Metrics

    7/20

    McCall's Quality Factors

    Product Operations

    Product

    Revision

    Product

    Transition

    Portability

    Reusability

    Interoperability

    Maintainability

    Flexibility

    Testability

    Correctness

    Reliability

    Efficiency

    Integrity

    Usability

  • 7/28/2019 13 Metrics

    8/20

    Operability

    Training

    Communicativeness

    Input/Output volume

    Input/Output gate

    Access Control

    Access Audit

    Storage efficiency

    Execution Efficiency

    Traceability

    Completeness

    AccuracyError Tolerance

    Consistency

    Simplicity

    Conciseness

    Instrumentation

    ExpandabilityGenerality

    Self-Descriptiveness

    Modularity

    Machine Independence

    Software System Independence

    Communications Commonality

    Data Commonality

    Usability

    Integrity

    Efficiency

    Correctness

    Reliability

    Maintainability

    Testability

    Flexibility

    Reusability

    Portability

    Interoperability

  • 7/28/2019 13 Metrics

    9/20

    ISO 9126Quality Characteristics and Guidelines for Their Use

    Quality Factors

    1. Functionality

    2. Reliability

    3. Usability

    4. Efficiency

    5. Maintainability

    6. Portability

  • 7/28/2019 13 Metrics

    10/20

    Design Metrics

    Fan In

    Fan Out

    Morphology based on number of nodes, depth, width

  • 7/28/2019 13 Metrics

    11/20

    Module Design Metrics

    Cohesion how many functions does a module perform

    coincidental

    logical - eg does all output temporal - eg all the startup work

    procedural - executed in this order

    communicational - module arrangement on work on what data

    functional

    Coupling how is the module connected to other modules

    global variable, parameters, stands alone

  • 7/28/2019 13 Metrics

    12/20

    Object-Oriented Metrics

    Weighted Methods per Class

    not only how many methods per class are there, but also

    how complex are they

    Depth of Inheritance Tree

    Number of Children

    how many child classes does a class have

    Response for Class number of local methods, plus number of methods they call

    Lack of Cohesion Metric

    number of non-intersecting (don't use the same variables)

    methods

  • 7/28/2019 13 Metrics

    13/20

    Lack of Cohesion Example

    Module A calls Module B

    B accesses Variable X

    C and D access Y

    D calls E

    This should be split into two classes.

    A

    B E

    DC

    XY

  • 7/28/2019 13 Metrics

    14/20

    Project Metrics

    LOC or FP per month

    Errors per LOC (aka Defect Density)

    Defect Removal Efficiency

    Time required to make changes

    Test coverage

    Required Skills

  • 7/28/2019 13 Metrics

    15/20

    Obviously,

    Beware of Statistics

    Version 2 Version 1Module# Defects LOC Defects/LOC Defects LOC Defects/LOC Relation

    1 12 777 0.01544 3 55 0.05455