Software Engineering Unit 6

24
3/18/2009 3/18/2009 S.Sreenivasa Rao S.Sreenivasa Rao 1 1 Chapter 15 Chapter 15 Product Metrics for Software Product Metrics for Software

description

Material

Transcript of Software Engineering Unit 6

  • 3/18/20093/18/2009 S.Sreenivasa RaoS.Sreenivasa Rao 11

    Chapter 15Chapter 15

    Product Metrics for SoftwareProduct Metrics for Software

  • 3/18/20093/18/2009 S.Sreenivasa RaoS.Sreenivasa Rao 22

    McCallMcCalls Triangle of Qualitys Triangle of QualityMaintainabilityMaintainabilityFlexibilityFlexibility

    TestabilityTestability

    PortabilityPortability

    ReusabilityReusability

    InteroperabilityInteroperability

    PRODUCT TRANSITIONPRODUCT TRANSITIONPRODUCT REVISIONPRODUCT REVISION

    CorrectnessCorrectness

    ReliabilityReliabilityUsabilityUsability EfficiencyEfficiency

    IntegrityIntegrity

    PRODUCT OPERATIONPRODUCT OPERATION

  • 3/18/20093/18/2009 S.Sreenivasa RaoS.Sreenivasa Rao 33

    A CommentA Comment

    McCallMcCalls quality factors were proposed in thes quality factors were proposed in theearly 1970s. They are as valid today as they wereearly 1970s. They are as valid today as they werein that time. Itin that time. Its likely that software built to conform s likely that software built to conform to these factors will exhibit high quality well intoto these factors will exhibit high quality well intothe 21st century, even if there are dramatic changesthe 21st century, even if there are dramatic changesin technology.in technology.

  • 3/18/20093/18/2009 S.Sreenivasa RaoS.Sreenivasa Rao 44

    Measures, Metrics and Measures, Metrics and IndicatorsIndicators

    A A measuremeasure provides a quantitative indication of provides a quantitative indication of the extent, amount, dimension, capacity, or size the extent, amount, dimension, capacity, or size of some attribute of a product or processof some attribute of a product or processThe IEEE glossary defines aThe IEEE glossary defines a metricmetric as as a a quantitative measure of the degree to which a quantitative measure of the degree to which a system, component, or process possesses a system, component, or process possesses a given attribute.given attribute.An An indicatorindicator is a metric or combination of metrics is a metric or combination of metrics that provide insight into the software process, a that provide insight into the software process, a software project, or the product itself software project, or the product itself

  • 3/18/20093/18/2009 S.Sreenivasa RaoS.Sreenivasa Rao 55

    Measurement PrinciplesMeasurement PrinciplesThe objectives of measurement should be The objectives of measurement should be established before data collection begins;established before data collection begins;Each technical metric should be defined in an Each technical metric should be defined in an unambiguous manner;unambiguous manner;Metrics should be derived based on a theory that Metrics should be derived based on a theory that is valid for the domain of application (e.g., is valid for the domain of application (e.g., metrics for design should draw upon basic design metrics for design should draw upon basic design concepts and principles and attempt to provide concepts and principles and attempt to provide an indication of the presence of an attribute that an indication of the presence of an attribute that is deemed desirable);is deemed desirable);Metrics should be tailored to best accommodate Metrics should be tailored to best accommodate specific products and processes [BAS84]specific products and processes [BAS84]

  • 3/18/20093/18/2009 S.Sreenivasa RaoS.Sreenivasa Rao 66

    Measurement ProcessMeasurement ProcessFormulationFormulation.. The derivation of software measures and metrics The derivation of software measures and metrics appropriate for the representation of the software that is beingappropriate for the representation of the software that is beingconsidered.considered.Collection.Collection. The mechanism used to accumulate data required to derive The mechanism used to accumulate data required to derive the formulated metrics.the formulated metrics.AnalysisAnalysis.. The computation of metrics and the application of The computation of metrics and the application of mathematical tools.mathematical tools.InterpretationInterpretation.. The evaluation of metrics results in an effort to gain The evaluation of metrics results in an effort to gain insight into the quality of the representation.insight into the quality of the representation.Feedback.Feedback. Recommendations derived from the interpretation of Recommendations derived from the interpretation of productproduct metrics transmitted to the software team.metrics transmitted to the software team.

  • 3/18/20093/18/2009 S.Sreenivasa RaoS.Sreenivasa Rao 77

    GoalGoal--Oriented Software Oriented Software MeasurementMeasurement

    Goal definition templateGoal definition template AnalyzeAnalyze {the name of activity or attribute to be measured} {the name of activity or attribute to be measured} for the purpose offor the purpose of {the overall objective of the analysis} {the overall objective of the analysis} with respect towith respect to {the aspect of the activity or attribute that is considered} {the aspect of the activity or attribute that is considered} from the viewpoint offrom the viewpoint of {the people who have an interest in the {the people who have an interest in the

    measurement} measurement} in the context ofin the context of {the environment in which the measurement takes {the environment in which the measurement takes

    place}.place}.The Goal/Question/Metric ParadigmThe Goal/Question/Metric Paradigm (1) establish an explicit measurement (1) establish an explicit measurement goalgoal that is specific to the that is specific to the

    process activity or product characteristic that is to be assesseprocess activity or product characteristic that is to be assessedd (2) define a set of (2) define a set of questionsquestions that must be answered in order to achieve that must be answered in order to achieve

    the goal, and the goal, and (3) identify well(3) identify well--formulatedformulated metricmetricss that help to answer these questions.that help to answer these questions.

  • 3/18/20093/18/2009 S.Sreenivasa RaoS.Sreenivasa Rao 88

    Metrics AttributesMetrics Attributessimple and computable.simple and computable. It should be relatively easy to learn how to derive It should be relatively easy to learn how to derive the metric, and its computation should not demand inordinate effthe metric, and its computation should not demand inordinate effort or timeort or timeempirically and intuitively persuasiveempirically and intuitively persuasive.. The metric should satisfy the The metric should satisfy the engineerengineers intuitive notions about the product attribute under considerats intuitive notions about the product attribute under considerationionconsistent and objectiveconsistent and objective.. The metric should always yield results that are The metric should always yield results that are unambiguous. unambiguous. consistent in its use of units and dimensionsconsistent in its use of units and dimensions.. The mathematical computation The mathematical computation of the metric should use measures that do not lead to bizarre coof the metric should use measures that do not lead to bizarre combinations mbinations of unit. of unit. programming language independentprogramming language independent.. Metrics should be based on the Metrics should be based on the analysis model, the design model, or the structure of the prograanalysis model, the design model, or the structure of the program itself. m itself. an effective mechanism for quality feedbackan effective mechanism for quality feedback.. That is, the metric should That is, the metric should provide a software engineer with information that can lead to a provide a software engineer with information that can lead to a higher quality higher quality end productend product

  • 3/18/20093/18/2009 S.Sreenivasa RaoS.Sreenivasa Rao 99

    Collection and Analysis PrinciplesCollection and Analysis Principles

    Whenever possible, data collection and Whenever possible, data collection and analysis should be automated;analysis should be automated;Valid statistical techniques should be Valid statistical techniques should be applied to establish relationship between applied to establish relationship between internal product attributes and external internal product attributes and external quality characteristics quality characteristics Interpretative guidelines and Interpretative guidelines and recommendations should be established for recommendations should be established for each metriceach metric

  • 3/18/20093/18/2009 S.Sreenivasa RaoS.Sreenivasa Rao 1010

    Analysis MetricsAnalysis Metrics

    FunctionFunction--based metricsbased metrics:: use the function use the function point as a normalizing factor or as a point as a normalizing factor or as a measure of the measure of the sizesize of the specificationof the specificationSpecification metricsSpecification metrics:: used as an indication used as an indication of quality by measuring number of of quality by measuring number of requirements by typerequirements by type

  • 3/18/20093/18/2009 S.Sreenivasa RaoS.Sreenivasa Rao 1111

    FunctionFunction--Based MetricsBased MetricsThe The function point metricfunction point metric (FP),(FP), first proposed by Albrecht [ALB79], can first proposed by Albrecht [ALB79], can be used effectively as a means for measuring the functionality be used effectively as a means for measuring the functionality delivered by a system.delivered by a system.Function points are derived using an empirical relationship baseFunction points are derived using an empirical relationship based on d on countable (direct) measures of software's information domain andcountable (direct) measures of software's information domain andassessments of software complexityassessments of software complexityInformation domain values are defined in the following manner:Information domain values are defined in the following manner: number of external inputs (number of external inputs (EIsEIs)) number of external outputs (number of external outputs (EOsEOs)) number of external inquiries (number of external inquiries (EQsEQs)) number of internal logical files (number of internal logical files (ILFsILFs)) Number of external interface files (Number of external interface files (EIFsEIFs))

  • 3/18/20093/18/2009 S.Sreenivasa RaoS.Sreenivasa Rao 1212

    Function PointsFunction PointsInformation

    Domain Value Count simple average complexWeighting factor

    External Inputs ( EIs)

    External Outputs ( EOs)

    External Inquiries ( EQs)

    Internal Logical Files ( ILFs)

    External Interface Files ( EIFs)

    3 4 6

    4 5 7

    3 4 6

    7 10 15

    5 7 10

    =

    =

    =

    =

    =

    Count total

    3

    3

    3

    3

    3

  • 3/18/20093/18/2009 S.Sreenivasa RaoS.Sreenivasa Rao 1313

    Architectural Design MetricsArchitectural Design MetricsArchitectural design metricsArchitectural design metrics Structural complexity = g(fanStructural complexity = g(fan--out)out) Data complexity = f(input & output variables, fanData complexity = f(input & output variables, fan--out)out) System complexity = h(structural & data complexity) System complexity = h(structural & data complexity)

    HK metric:HK metric: architectural complexity as a function of fanarchitectural complexity as a function of fan--in in and fanand fan--outoutMorphology metrics:Morphology metrics: a function of the number of modules a function of the number of modules and the number of interfaces betweenand the number of interfaces between modulesmodules

  • 3/18/20093/18/2009 S.Sreenivasa RaoS.Sreenivasa Rao 1414

    Metrics for OO DesignMetrics for OO Design--IIWhitmireWhitmire [WHI97] describes nine distinct and measurable [WHI97] describes nine distinct and measurable characteristics of an OO design:characteristics of an OO design: SizeSize

    Size is defined in terms of four views: population, volume, Size is defined in terms of four views: population, volume, length, and functionalitylength, and functionality

    ComplexityComplexityHow classes of an OO design are interrelated to one anotherHow classes of an OO design are interrelated to one another

    CouplingCouplingThe physical connections between elements of the OO designThe physical connections between elements of the OO design

    SufficiencySufficiencythe degree to which an abstraction possesses the features the degree to which an abstraction possesses the features required of it, or the degree to which a design component required of it, or the degree to which a design component possesses features in its abstraction, from the point of view ofpossesses features in its abstraction, from the point of view ofthe current application.the current application.

    CompletenessCompletenessAn indirect implication about the degree to which the abstractioAn indirect implication about the degree to which the abstraction n or design component can be reusedor design component can be reused

  • 3/18/20093/18/2009 S.Sreenivasa RaoS.Sreenivasa Rao 1515

    Metrics for OO DesignMetrics for OO Design--IIII CohesionCohesion

    The degree to which all operations working together The degree to which all operations working together to achieve a single, wellto achieve a single, well--defined purposedefined purpose

    PrimitivenessPrimitivenessApplied to both operations and classes, the degree to Applied to both operations and classes, the degree to which an operation is atomicwhich an operation is atomic

    SimilaritySimilarityThe degree to which two or more classes are similar The degree to which two or more classes are similar in terms of their structure, function, behavior, or in terms of their structure, function, behavior, or purposepurpose

    VolatilityVolatility

  • 3/18/20093/18/2009 S.Sreenivasa RaoS.Sreenivasa Rao 1616

    Distinguishing CharacteristicsDistinguishing Characteristics

    LocalizationLocalizationthe way in which information is concentrated in the way in which information is concentrated in a programa programEncapsulationEncapsulationthe packaging of data and processingthe packaging of data and processingInformation hidingInformation hidingthe way in which information about the way in which information about operational details is hidden by a secure interfaceoperational details is hidden by a secure interfaceInheritanceInheritancethe manner in which the responsibilities of one the manner in which the responsibilities of one class are propagated to anotherclass are propagated to anotherAbstractionAbstractionthe mechanism that allows a design to focus on the mechanism that allows a design to focus on essential detailsessential details

    Berard [BER95] argues that the following characteristics require that special OO metrics be developed:

  • 3/18/20093/18/2009 S.Sreenivasa RaoS.Sreenivasa Rao 1717

    ClassClass--Oriented MetricsOriented Metrics

    weighted methods per classweighted methods per classdepth of the inheritance treedepth of the inheritance treenumber of childrennumber of childrencoupling between object coupling between object classesclassesresponse for a classresponse for a classlack of cohesion in methodslack of cohesion in methods

    Proposed by Proposed by ChidamberChidamber and and KemererKemerer::

  • 3/18/20093/18/2009 S.Sreenivasa RaoS.Sreenivasa Rao 1818

    ClassClass--Oriented MetricsOriented Metrics

    class sizeclass sizenumber of operations overridden by a number of operations overridden by a subclasssubclassnumber of operations added by a number of operations added by a subclasssubclassspecialization indexspecialization index

    Proposed by Lorenz and Kidd [LOR94]:Proposed by Lorenz and Kidd [LOR94]:

  • 3/18/20093/18/2009 S.Sreenivasa RaoS.Sreenivasa Rao 1919

    ClassClass--Oriented MetricsOriented Metrics

    Method inheritance factorMethod inheritance factorCoupling factorCoupling factorPolymorphism factorPolymorphism factor

    The MOOD Metrics SuiteThe MOOD Metrics Suite

  • 3/18/20093/18/2009 S.Sreenivasa RaoS.Sreenivasa Rao 2020

    OperationOperation--Oriented MetricsOriented Metrics

    average operation sizeaverage operation sizeoperation complexityoperation complexityaverage number of parameters per average number of parameters per operationoperation

    Proposed by Lorenz and Kidd [LOR94]:Proposed by Lorenz and Kidd [LOR94]:

  • 3/18/20093/18/2009 S.Sreenivasa RaoS.Sreenivasa Rao 2121

    ComponentComponent--Level Design Level Design MetricsMetrics

    Cohesion metrics:Cohesion metrics: a function of data objects a function of data objects and the locus of their definitionand the locus of their definitionCoupling metrics:Coupling metrics: a function of input and a function of input and output parameters, global variables, and output parameters, global variables, and modules calledmodules calledComplexity metrics:Complexity metrics: hundreds have been hundreds have been proposed (e.g., cyclomatic complexity)proposed (e.g., cyclomatic complexity)

  • 3/18/20093/18/2009 S.Sreenivasa RaoS.Sreenivasa Rao 2222

    Interface Design MetricsInterface Design Metrics

    Layout appropriateness:Layout appropriateness: a function of layout a function of layout entities, the geographic position and the entities, the geographic position and the costcost of making transitions among entitiesof making transitions among entities

  • 3/18/20093/18/2009 S.Sreenivasa RaoS.Sreenivasa Rao 2323

    Code MetricsCode MetricsHalsteadHalsteads Software Science:s Software Science: a comprehensive collection of a comprehensive collection of metrics all predicated on the number (count and occurrence) of metrics all predicated on the number (count and occurrence) of operators and operands within a component or programoperators and operands within a component or program It should be noted that HalsteadIt should be noted that Halsteads s lawslaws have generated have generated

    substantial controversy, and many believe that the substantial controversy, and many believe that the underlying theory has flaws. However, experimental underlying theory has flaws. However, experimental verification for selected programming languages has been verification for selected programming languages has been performed (e.g. [FEL89]).performed (e.g. [FEL89]).

  • 3/18/20093/18/2009 S.Sreenivasa RaoS.Sreenivasa Rao 2424

    Metrics for TestingMetrics for TestingTesting effort can also be estimated using metrics derived Testing effort can also be estimated using metrics derived from Halstead measuresfrom Halstead measuresBinder [BIN94] suggests a broad array of design metrics Binder [BIN94] suggests a broad array of design metrics that have a direct influence on the that have a direct influence on the testabilitytestability of an OO of an OO system. system. Lack of cohesion in methods (LCOM). Lack of cohesion in methods (LCOM). Percent public and protected (PAP). Percent public and protected (PAP). Public access to data members (PAD). Public access to data members (PAD). Number of root classes (NOR). Number of root classes (NOR). FanFan--in (FIN). in (FIN). Number of children (NOC) and depth of the inheritance Number of children (NOC) and depth of the inheritance

    tree (DIT).tree (DIT).

    Chapter 15Product Metrics for SoftwareMcCalls Triangle of QualityA CommentMeasures, Metrics and IndicatorsMeasurement PrinciplesMeasurement ProcessGoal-Oriented Software MeasurementMetrics AttributesCollection and Analysis PrinciplesAnalysis MetricsFunction-Based MetricsFunction PointsArchitectural Design MetricsMetrics for OO Design-IMetrics for OO Design-IIDistinguishing CharacteristicsClass-Oriented MetricsClass-Oriented MetricsClass-Oriented MetricsOperation-Oriented MetricsComponent-Level Design MetricsInterface Design MetricsCode MetricsMetrics for Testing