Você está na página 1de 21

Correlation of External Metric

with Internal Metrics of QMOOD


SOEN-6611 (Software Measurement )
Submitted to : Prof. Nikolaos Tsantalis

Presented By: Team D

OUTLINE

INTRODUCTION

HYPOTHESIS

9 INTERNAL METRICS

1 EXTERNAL METRIC MAINTAINABILITY

ASSUMPTIONS

CHALLENGES

CORRELATION

LINEAR REGRESSION

UNIVARIATE REGRESSION

Introduction

Type of Study Type 1 (Correlation between metrics)

Project JfreeChart (versions- 1.0.11 to 1.0.18)

Metrics Implemented Internal metrics of QMOOD(CACM,


MOA,MFA,ANA, DAM,DCC, NOP, CIS and NOM) and one External
metric(Maintainability).

Tools Used - Kalimatrix Logiscope, CKJM, Eclipse, Jdeodarant, SPSS tool and
Rstudio.

Hypothesis
CACM(Cohesion among methods of classes)affects maintainability negatively.
MOA(Measure of Aggregation) affects maintainability positively.
MFA(Measure of Functional Abstraction) affects maintainability in a negative way as it leads to reduction in
duplicate code.
ANA(Average number of Ancestors) affects maintainability negatively as it also leads to decrease in code
duplication.
DAM(Data Access metrics) affects maintainability in positive way.
DCC(DirectClass Coupling) affects maintainability in positive way.
NOP(Number of Polymorphic methods) affects maintainability positively.
CIS(Class Interface size) affects maintainability in a negative way.
NOM(Number of Methods) affects maintainability positively.

Internal Metrics
CACM(Cohesionamongmethodsofclasses)
Computestherelatednessamongmethodsofaclass.
ItiscomputedbasedontheparameterOccurrenceMetrix

where k is the number of methods in a class


and l is the number of the distinct parameter types

MOA(MeasureofAggregation)
MOAcountsofthepartwholerelationshipsrealizedbyattributes.
Itisacountofthenumberofdatadeclarations(classfields)whosetypesareuser
definedclasses.
MFA(MeasureofFunctionalAbstraction)
MFAgivestheratioofthenumberofinheritedmethodsbyaclasstothetotal
numberoflocalmethodsintheclass(inherited+defined). (Range0to1)

ANA(AveragenumberofAncestors)
Thismetriccalculatesthenumberofclassesfromwhichaclassinheritsinformation.
ThismetricisequivalenttoDIT(DepthofInheritanceTree)fromChidamberand
Kemerer.
DAM(DataAccessmetrics)
ThismetriccalculatesTheratioofthenumberofprivate(protected)attributestothe
totalnumberofattributesdeclaredintheclass.
DCC(DirectClassCoupling)
Thismetriccountsthedifferentnumberofclassesthataclassisdirectlyrelatedto
(byattributedeclarationsandparameters).

NOP(NumberofPolymorphicmethods)
NOPcountsthenumberofabstractmethodinaclass.
CIS(ClassInterfacesize)
CISkeepsacountofthenumberofpublicmethodsinaclass.
NOM(NumberofMethods)
Thismetricgeneratesacountofallthemethodsdefinedinaclass.

EXTERALMETRIC
MAINTAINABILITY=ANALYZABILITYc+CHANGEABILITYc+
STABILITYc+TESTABILITYc
FACTOR

FORMULA

ANALYZIBILITY

cl_wmc + cl_comf + in_bases + cu_cdused


Weighted method per class+ Common rate* + Number
of direct used classes .
Note: *Common rate = Number of comment /Lines
of code.

CHANGEABILITY

cl_stat + cl_func + cl_data


Number of statements + Total number of methods +
Total Number of attributes.

TESTABILITY

cl_wmc + cl_func + cu_cdused


Weighted methods per class + Total number of
method inside the class + Number of direct used
classes.

STABILITY

cl_data_publ + cu_cdusers + in_noc + cl_func_publ


Public attribute + Number of direct used classes +
Number of children + Number of public method.

ASSUMPTIONS
ForcomputingtheNOHmetric,weassumedthatifthereisasamesuperclassfor
multipleclassesthenitwillbecountedonlyonceforcalculatingnumberof
hierarchies.

ForcomputingtheCACMmetric,weassumedthattheconstructoriscountedin
boththenumberofmethodsaswellasnumberofdistinctparametersinaclass.

ForcalculatingtheMFAmetric,weassumedthatconstructorsarealsocountedin
totalnumberoflocalmethodsdefinedinaclass.

Challenges
Challengesduringimplementationofmetrics:
NOH
Tocomputethesuperclassforeveryclass.Ifaclasshasmorethanone
subclass,thenprogramcountsduplicatehierarchyvalueduetostoring
superclassobjectintoarray.
Toovercomethisissue,wediscoveredeachandeveryinstanceoftheclasses.
Usingthoseinstances,wecheckedforsuperclassandthenstoredsuperclass
objectintosetdatatypewhichcontainsnoduplicateelementswhichgives
uniquenumberofhierarchy.
NOM and NOP
ForcalculatingNOMandNOPvalue,weneedtotakelistofmethodsand
constructorsdefinedinaclassbutpackagedoesntprovidethelist.
AddinggetMethodList()andgetConstructorList()inclassObjectclass.

To be contd.
MFA
Discoveringthenumberofinheritedmethods.
Overcome:Toachievethistask,wehadtofindthesuperclassofthatclassand
comparedeachsuperclassmethodnamewiththecurrentclassmethodnameusing
aforloop.
ReceivedsuggestiontouseoverridesMethod()thisgivesustheBooleanreturn
type.
Checkwhethersuperclassisnullornot.
.
We tried to match the values for MFA. However, they were different. So, we
didntincludeitinthefinaldocument.
ANA
Finding the root class. We had to run while loop by passing dynamic super
classinstance.
Overcome:Checkwhethersuperclassisnullornot.Ifitsnotnull,thenwepass
theinstance in whileloopuntil superclassinstancebecomenull.Insidewhile
loop,wecalculatedthecountervalueinordertogetthenumberofsuperclass.

CORRELATION
CorrelationiscomputedbasedonthePearsonsCorrelationCoefficient
Formulagivenby:

Itgivesusthelinearrelationbetweentwovariables.
Correlation

Negative

Positive

None

0.09 to 0.0

0.0 to 0.09

Small

0.3 to 0.1

0.1 to 0.3

Medium

0.5 to 0.3

0.3 to 0.5

Strong

1.0 to 0.5

0.5 to 1.0

Correlation between DCC and


Maintainability
Maintainability

DCC

195.178
199.87
201.49
203.89
202.195
189.78
189.52
189.71

Strength
0.61168

STRONG

0.61028

STRONG

0.60171

STRONG

0.61643

MEDIUM

0.62034

STRONG

0.62106
0.5472
0.22212

MEDIUM
STRONG
SMALL

Linear Regression - DCC


0.7

0.6

f(x) = 0.01x - 1.7


R = 0.27

0.5

0.4

0.3

0.2

0.1

0
188

190

192

194

196

198

200

202

204

206

Correlation between CIS and


Maintainability
Maintainability

CIS

195.178
199.87
201.49
203.89
202.195
189.78
189.52
189.71

strength
0.89299

STRONG

0.89546

STRONG

0.89908

STRONG

0.90257

STRONG

0.90267

STRONG

0.90554
0.77258
0.35313

STRONG
STRONG
MEDIUM

Linear Regression - CIS


1
0.9

f(x) = 0.02x - 2.56


R = 0.3

0.8
0.7
0.6
0.5
0.4
0.3
0.2
0.1
0
188

190

192

194

196

198

200

202

204

206

Correlation between NOM and Maintainability


Maintainability

NOM

195.178
199.87
201.49
203.89
202.195
189.78
189.52
189.71

strength
0.91635

STRONG

0.91901

STRONG

0.92136

STRONG

0.92384

STRONG

0.92379

STRONG

0.92758
0.79142
0.36907

STRONG
STRONG
MEDIUM

Linear Regression NOM


1
0.9

f(x) = 0.02x - 2.58


R = 0.3

0.8
0.7
0.6
0.5
0.4
0.3
0.2
0.1
0
188

190

192

194

196

198

200

202

204

206

Univariate Linear Regression


Versions/Metri
cs
JfreeChart
1.0.11
JfreeChart
1.0.12
JfreeChart
1.0.13
JfreeChart
1.0.14
JfreeChart
1.0.15
JfreeChart
1.0.16
JfreeChart
1.0.17
JfreeChart
1.0.18

F
Sig.
F
Sig.
F
Sig.
F
Sig.
F
Sig.
F
Sig.
F
Sig.
F
Sig.

ANA

DAM

DCC

CACM

MOA

MFA

NOP

CIS

NOM

0.319
0.812
0.445
0.721
0.424
0.791
0.364
0.779
0.111
0.954
0.118
0.949
0.697
0.554
0.543
0.653

1.985
0.033
1.787
0.68
1.423
0.146
1.162
0.307
1.13
0.33
1.079
0.375
0.337
0.986
4.78
0

10.684
0
10.835
0
10.465
0
11.038
.
0
8.714
0
6.266
0
1.649
0.145
0.276
0.926

3.359
0
4.069
0
5.118
0
4.156
0
3.784
0
2.403
0
0.819
0.917
0.982
0.542

1.457
0.228
1.719
0.19
4.028
0.045
3.168
0.076
3.969
0.047
8.294
0.004
5.39
0.021
0.011
0.916

2.353
0
1.593
0.003
1.853
0
1.649
0.001
1.52
0.006
1.933
0
1.586
0.003
5.589
0

0.643
0.423
0.422
0.516
0.452
0.501
0.557
0.456
0.492
0.483
0.278
0.598
0.816
0.443
0.819
0.441

8.001
0
4.693
0
5.627
0
6.309
0
6.451
0
3.749
0
0.878
0.595
0.781
0.717

6.753
0
9.254
0
7.723
0
5.474
0
4.928
0
7.768
0
0.927
0.542
1.194
0.26

R2
0.989
0.989
0.991
0.99
0.989
0.988
0.878
0.699

Conclusions

Você também pode gostar