comparison of object-oriented and paradigm independent software complexity metrics
Post on 31-Jan-2016
58 Views
Preview:
DESCRIPTION
TRANSCRIPT
Comparison of Object-Comparison of Object-Oriented andOriented and
Paradigm IndependentParadigm IndependentSoftware Complexity MetricsSoftware Complexity Metrics
ZolZoltán Porkoláb, Ádám Sillyetán Porkoláb, Ádám SillyeDepartment of Programming Languages and CompilersDepartment of Programming Languages and Compilers
Eötvös Loránd University, Faculty of InformaticsEötvös Loránd University, Faculty of Informatics
e-mail: {ge-mail: {gsdsd|madic}@elte.hu|madic}@elte.hu
22ICAI 6 Eger - Comparison of Object-Oriented and Paradigm Independent Software Complexity MetricsICAI 6 Eger - Comparison of Object-Oriented and Paradigm Independent Software Complexity Metrics
The structure of the presentationThe structure of the presentation
The role of software metricsThe role of software metrics
Metrics: an overviewMetrics: an overview
Object-oriented software metricsObject-oriented software metrics
Multiparadigm programmingMultiparadigm programming
The AV-graphThe AV-graph
Empirical resultsEmpirical results
33ICAI 6 Eger - Comparison of Object-Oriented and Paradigm Independent Software Complexity MetricsICAI 6 Eger - Comparison of Object-Oriented and Paradigm Independent Software Complexity Metrics
Role of software metricsRole of software metrics
Cost of the softwareCost of the software SpecificationSpecification DesignDesign ImplemeImplementationntation TesTesting & Bug-fixingting & Bug-fixing MaintenanceMaintenance
More than More than 70% 70% of cost is for testing and maintenanceof cost is for testing and maintenance (Zuse 1998)(Zuse 1998)
Software qualitySoftware quality
44ICAI 6 Eger - Comparison of Object-Oriented and Paradigm Independent Software Complexity MetricsICAI 6 Eger - Comparison of Object-Oriented and Paradigm Independent Software Complexity Metrics
SoftSoftwareware metricsmetrics
Software metricsSoftware metrics:: Measuring the development process (process metrics)Measuring the development process (process metrics) Measuring the productMeasuring the product ( (product metricsproduct metrics))
Product metricsProduct metrics:: External metricsExternal metrics::
Reliability metricsReliability metricsFunctional metricsFunctional metricsEfficiency metricsEfficiency metrics
Internal product metricsInternal product metrics::SizeSize ComplexityComplexityStStyleyle
55ICAI 6 Eger - Comparison of Object-Oriented and Paradigm Independent Software Complexity MetricsICAI 6 Eger - Comparison of Object-Oriented and Paradigm Independent Software Complexity Metrics
Product metricsProduct metrics
Size metricsSize metrics:: LOC, eLOCLOC, eLOC Ignore the semanticIgnore the semantic
Structural metricsStructural metrics::
McCabe 1976McCabe 1976 MotivationMotivation: : predict testing effortspredict testing efforts For structured programsFor structured programs: V(G) = p + 1: V(G) = p + 1
HowattHowatt and and Baker 1989 Baker 1989 MotivationMotivation: : involve nesting levelinvolve nesting level SN(G) = |N|+ND(G)SN(G) = |N|+ND(G)
66ICAI 6 Eger - Comparison of Object-Oriented and Paradigm Independent Software Complexity MetricsICAI 6 Eger - Comparison of Object-Oriented and Paradigm Independent Software Complexity Metrics
Object-oriented metrics in theoryObject-oriented metrics in theory
Chidamber-Kemerer (1994)Chidamber-Kemerer (1994) OO metrics suite: OO metrics suite: WMC (Weighted Methods per Class)WMC (Weighted Methods per Class) DIT (Depth of Inheritance Tree, DIT)DIT (Depth of Inheritance Tree, DIT) NOC (Number of ChildNOC (Number of Child Classes Classes)) CBO (Coupling Between Object Classes)CBO (Coupling Between Object Classes) fan-in fan-in
and fan outand fan out RFC (Response for Class)RFC (Response for Class) LCOM (Lack of Cohesion in Methods)LCOM (Lack of Cohesion in Methods)
Chidamber - KemererChidamber - Kemerer
Henderson - SellersHenderson - Sellers
77ICAI 6 Eger - Comparison of Object-Oriented and Paradigm Independent Software Complexity MetricsICAI 6 Eger - Comparison of Object-Oriented and Paradigm Independent Software Complexity Metrics
Object-Oriented metrics in practiceObject-Oriented metrics in practice
EclipseEclipse ( (www.eclipse.orgwww.eclipse.org))
McCabe McCabe cyclomatic complexitycyclomatic complexity Efferent couplingEfferent coupling ( (≠ fan out!)≠ fan out!) Lack of CohesionLack of Cohesion LOC (Lines of Code)LOC (Lines of Code) Number of Fields in ClassesNumber of Fields in Classes Nesting DepthNesting Depth Number of Number of Method Method ParametersParameters Number of StatementsNumber of Statements Weighted Methods per ClassWeighted Methods per Class
88ICAI 6 Eger - Comparison of Object-Oriented and Paradigm Independent Software Complexity MetricsICAI 6 Eger - Comparison of Object-Oriented and Paradigm Independent Software Complexity Metrics
Software paradigmSoftware paradigm
Evolution of Software paradigmEvolution of Software paradigm Structured programmingStructured programming Object-oriented programmingObject-oriented programming
Classes, inheritance, virtual functionClasses, inheritance, virtual function Generative programming Generative programming
Aspect-Oriented (Kitzales 1994)Aspect-Oriented (Kitzales 1994)
Intentional (Simonyi 1995)Intentional (Simonyi 1995)
Template metaprogramming (Veldhuizen 1994)Template metaprogramming (Veldhuizen 1994)
Multiparadigm programming (Coplien 1998)Multiparadigm programming (Coplien 1998) Simultaneous usage of paradigmsSimultaneous usage of paradigms
99ICAI 6 Eger - Comparison of Object-Oriented and Paradigm Independent Software Complexity MetricsICAI 6 Eger - Comparison of Object-Oriented and Paradigm Independent Software Complexity Metrics
Paradigm-independent Software MetricsParadigm-independent Software Metrics
Applicable for programs written in different Applicable for programs written in different paradigms or paradigms or in in mixed-paradigm environment mixed-paradigm environment
Based on general programming language features which Based on general programming language features which are paradigm- and language-independent.are paradigm- and language-independent.The paradigm-dependent attributes are derived fromThe paradigm-dependent attributes are derived fromthese features.these features.
1010ICAI 6 Eger - Comparison of Object-Oriented and Paradigm Independent Software Complexity MetricsICAI 6 Eger - Comparison of Object-Oriented and Paradigm Independent Software Complexity Metrics
ComponentsComponents
Control Structure of ProgramControl Structure of Program Most of the programs share the same control Most of the programs share the same control
statementsstatements
Complexity of Data TypesComplexity of Data Types Reflects the complexity of data types used (like Reflects the complexity of data types used (like
classes)classes)
Complexity of Data AccessComplexity of Data Access Connection between control structure and data Connection between control structure and data
Direction of data flowDirection of data flowNesting depthNesting depth
1111ICAI 6 Eger - Comparison of Object-Oriented and Paradigm Independent Software Complexity MetricsICAI 6 Eger - Comparison of Object-Oriented and Paradigm Independent Software Complexity Metrics
AV-graphAV-graph
smain
P1
tmain
b
P4
ac
d1
d3d4
d2
data node
output node
input node
1212ICAI 6 Eger - Comparison of Object-Oriented and Paradigm Independent Software Complexity MetricsICAI 6 Eger - Comparison of Object-Oriented and Paradigm Independent Software Complexity Metrics
AV-grAV-graphaph metrics metrics
|N||N| number of nodesnumber of nodes
nd(n) = | Pred(n) |nd(n) = | Pred(n) | nesting depth of node ‘n’ nesting depth of node ‘n’
ND(G) = ND(G) = nd(n)nd(n) for all nodes for all nodes
C(G) = |N’| + ND(G)C(G) = |N’| + ND(G)
C(O) = |N’| + C(O) = |N’| + ND(G) ND(G)
= |A| + = |A| + ( (ND(G) + |L|)ND(G) + |L|)
1313ICAI 6 Eger - Comparison of Object-Oriented and Paradigm Independent Software Complexity MetricsICAI 6 Eger - Comparison of Object-Oriented and Paradigm Independent Software Complexity Metrics
Complexity of classComplexity of class
Control structureControl structuress Complexity of Complexity of method method control structurecontrol structuress
Complexity of data typeComplexity of data typess Local variables in methodsLocal variables in methods Attributes (could be complex types)Attributes (could be complex types) Coupling between classesCoupling between classes InheritanceInheritance
Complexity of data handlingComplexity of data handling Connection between control structure and dataConnection between control structure and data
1414ICAI 6 Eger - Comparison of Object-Oriented and Paradigm Independent Software Complexity MetricsICAI 6 Eger - Comparison of Object-Oriented and Paradigm Independent Software Complexity Metrics
class date{public: void set_next_month() { if ( month == 12 ) { month = 1; year = year + 1; } else { month = month + 1; } } void set_next_day() { if ( month == 1 || month == 3 || ... || month == 12 ) if ( day == 31 ) set_next_month(); else day = day + 1; else if ( day == 30 ) set_next_month(); else day = day + 1; }private:
int year, month, day;};
Complexity of ClassComplexity of Class
sset_next_month
P1
tsnm
b
a c
sset_next_day
P2
tsnm
e
P3
gf
P4d1
d3
d2
1515ICAI 6 Eger - Comparison of Object-Oriented and Paradigm Independent Software Complexity MetricsICAI 6 Eger - Comparison of Object-Oriented and Paradigm Independent Software Complexity Metrics
Our Our Measuring toolMeasuring tool
Supported lSupported languageanguagess Java 1.3Java 1.3 Java 1.4Java 1.4 (assert) (assert) Future directionFuture directionss: C# and C++: C# and C++
ImplementationImplementation ANTLRANTLR User interface: sUser interface: standalonetandalone application and application and
Eclipse Plug-inEclipse Plug-in
OuputOuput CSVCSV XMLXML
1616ICAI 6 Eger - Comparison of Object-Oriented and Paradigm Independent Software Complexity MetricsICAI 6 Eger - Comparison of Object-Oriented and Paradigm Independent Software Complexity Metrics
Applied MetricsApplied Metrics
Object-Oriented MetricsObject-Oriented Metrics Inner Class DepthInner Class Depth Inheritance levelInheritance level Number of ChildrenNumber of Children Number of MethodsNumber of Methods Number of FieldsNumber of Fields LCOMLCOM Henderson-SellersHenderson-Sellers LCOM* LCOM* Fan-outFan-out
1717ICAI 6 Eger - Comparison of Object-Oriented and Paradigm Independent Software Complexity MetricsICAI 6 Eger - Comparison of Object-Oriented and Paradigm Independent Software Complexity Metrics
Applied MetricsApplied Metrics
Size MetricsSize Metrics eLOCeLOC Number of StatementsNumber of Statements
McCabeMcCabe
Howatt-BakerHowatt-Baker
AV-graphAV-graph
1818ICAI 6 Eger - Comparison of Object-Oriented and Paradigm Independent Software Complexity MetricsICAI 6 Eger - Comparison of Object-Oriented and Paradigm Independent Software Complexity Metrics
Test DataTest Data
Java Standard Library 1.4.2Java Standard Library 1.4.2 367367.000.000 eLOC eLOC
jBOSS 3.2.3jBOSS 3.2.3 300300.000.000 eLOC eLOC
Omg.org.CORBAOmg.org.CORBA 55.000.000 eLOC eLOC
The measure tool (with mostly generated parser)The measure tool (with mostly generated parser) 77.000.000 eLOC eLOC
Eclipse 3.0M6Eclipse 3.0M6 900900.000.000 eLOCeLOC
17.000 17.000 cclasslass – more than 1.5 million lines – more than 1.5 million lines
1919ICAI 6 Eger - Comparison of Object-Oriented and Paradigm Independent Software Complexity MetricsICAI 6 Eger - Comparison of Object-Oriented and Paradigm Independent Software Complexity Metrics
Calibrating our toolCalibrating our tool
Goal: Goal: Achieve similar results with other measuring Achieve similar results with other measuring
programs. (Otherwise we are unable to compare the programs. (Otherwise we are unable to compare the results.)results.)
DifficultiesDifficulties Metrics are not defined precisely enough from the Metrics are not defined precisely enough from the
view of implementation.view of implementation. Available toolsAvailable tools
working on different abstract program tree.working on different abstract program tree.use simplified metrics definitions.use simplified metrics definitions.and have several bugs.and have several bugs.
2020ICAI 6 Eger - Comparison of Object-Oriented and Paradigm Independent Software Complexity MetricsICAI 6 Eger - Comparison of Object-Oriented and Paradigm Independent Software Complexity Metrics
ExampleExample
Lack of Cohesion in MethodsLack of Cohesion in Methods P = method pairs that access different fieldsP = method pairs that access different fields Q = method pairs that access at least one common Q = method pairs that access at least one common
fieldfield LCOM = |P|-|Q| if |P|-|Q|LCOM = |P|-|Q| if |P|-|Q|≥0, otherwise 0.≥0, otherwise 0.
References to References to thisthis and and supersuper have to be counted or have to be counted or not in the sense of cohesion?not in the sense of cohesion? No, but some tools count them.No, but some tools count them.
2121ICAI 6 Eger - Comparison of Object-Oriented and Paradigm Independent Software Complexity MetricsICAI 6 Eger - Comparison of Object-Oriented and Paradigm Independent Software Complexity Metrics
ResultsResults
No statistical correlation between the OO and multi No statistical correlation between the OO and multi paradigm metrics:paradigm metrics: OO metrics only measure the big pictureOO metrics only measure the big picture MPM consider more properties: higher densityMPM consider more properties: higher density The structural complexity of methods are extremely The structural complexity of methods are extremely
increase the overall complexity.increase the overall complexity.
2222ICAI 6 Eger - Comparison of Object-Oriented and Paradigm Independent Software Complexity MetricsICAI 6 Eger - Comparison of Object-Oriented and Paradigm Independent Software Complexity Metrics
ConclusionConclusion
Implementations are not reliable yet:Implementations are not reliable yet: No precise definition for metricsNo precise definition for metrics Different input data: languagesDifferent input data: languages Tools:Tools:
Various interpretation of definitions.Various interpretation of definitions.
Various bugs.Various bugs.
Results of different tools cannot be compared.Results of different tools cannot be compared.
Future examination...Future examination...
top related