wcre13c.pdf

14
Mining the Relationship between Mining the Relationship between Anti Anti - - patterns patterns Dependencies and Fault Dependencies and Fault - - Proneness Proneness Fehmi Fehmi Jaafar Jaafar, Sylvie Hamel Sylvie Hamel Yann Yann- Ga Gaël Gu Guéhé neuc, neuc, Foutse Foutse Khomh Khomh

Upload: ptidej-team

Post on 18-Dec-2014

103 views

Category:

Technology


0 download

DESCRIPTION

Anti-patterns, dependencies, faults, propagation

TRANSCRIPT

Page 1: Wcre13c.pdf

Mining the Relationship between Mining the Relationship between AntiAnti--patternspatterns

Dependencies and FaultDependencies and Fault--PronenessProneness

FehmiFehmi JaafarJaafar,,

Sylvie HamelSylvie Hamel

YannYann--GaGaëëll GuGuééhhééneuc, neuc,

FoutseFoutse KhomhKhomh

Page 2: Wcre13c.pdf

2

Anti-patterns describe poor solutions to

design and implementation problems…

…they are not technically incorrect and don't

currently prevent the program from

functioning.

Instead, they indicate weaknesses in design

that may be slowing down development or

increasing the risk of bugs or failures in the

future.

Page 3: Wcre13c.pdf

3

Examples of AntiExamples of Anti--patternspatterns

Large controller class, low cohesion, associated with simple, data-object classes…

Blob Spaghetti Code

Process oriented methods, object methods with no parameters, class or global variables utilization, flow of execution dictated by object implementation, not by the clients of the objects.

Page 4: Wcre13c.pdf

4

MotivationMotivationMany studies have investigated the

impact of anti-patterns on

•Maintenance [Yamashita, 2013]

•Fault-proneness [Khomh, 2012]

•Change-proneness [Romano, 2012]

-----

Page 5: Wcre13c.pdf

5

MotivationMotivation

Yet, classes sharing static

relationships with anti-patterns

have been mostly ignored…

We conjecture that, static and co-change relationships with

anti-patterns can impact the fault-proneness of classes

without anti-patterns.

Page 6: Wcre13c.pdf

6

source code repository

source code repository

AntipatternsdetectionDECOR

AntipatternsdetectionDECOR

Relationships retrieval

Macocha

Relationships retrieval

Macocha

AnalysesAnalyses

ApproachApproach

BugzillaBugzilla

Bug informationIbdoos

Bug informationIbdoos

Page 7: Wcre13c.pdf

7

Subject systems

# Classes 3,325 1,615 1,191

# Snapshots 4,480 2,010 159,196

Data CollectionData Collection

• Antisingleton

• Blob

• ClassDataShouldBePrivate (CDSBP)

• ComplexClass

• LazyClass

• LongMethod

• MessageChain

• RefusedParameterBequest

• SpaghettiCode

• SpeculativeGenerality

• SwissArmyKnife

• LongParameterList

Anti-patterns detected with DECOR…

Page 8: Wcre13c.pdf

CoCo--change and Static relationships change and Static relationships with with AntipatternsAntipatternsAnti-patterns Systems # of CC # of S.R

13 152Anti singleton 20 201

18 18851 304

Blob 36 16424 934 167

CDSBP 0 820 1132 192

ComplexClass 0 1460 9642 282

LongMethod 51 3140 26612 344

LongParameterList 0 2760 309

Anti-patterns Systems # of CC # of S.R48 244

MessageChains 8 19616 18347 326

RefusedParentBequest 6 18325 930 0

Spaghetti Code 0 00 013 128

SpeculativeGenerality 4 1398 20120 69

SwissArmyKnife 9 14218 108

Page 9: Wcre13c.pdf

9

Research QuestionsResearch Questions

Page 10: Wcre13c.pdf

10

Analysis MethodsAnalysis Methods

HRQ: The proportions of faults carried by classes having static (resp. Co-change) relationships with anti-patterns and other classes are the same.

Page 11: Wcre13c.pdf

RQ1: Are classes that have static RQ1: Are classes that have static relationships with antirelationships with anti--patterns patterns

more faultmore fault--prone than other prone than other classes?classes?

Classes with S.R with AP 1062 1003

Classes with S.R with AP and that are not AP 402 600

Other classes 681 579

Classes with S.R with AP 432 226

Classes with S.R with AP and that are not AP. 281 103Other classes 310 647

Classes with S.R with AP 445 121Classes with S.R with AP and that are not AP. 262 75

Other classes 126 499

Faults No-Faults Odd RatiosTotal of classes related to AP 1939 1350 2.22Classes with S.R with AP and that are not AP. 945 778 1.88Total of other classes 1117 1725 1

P-value = 2.2 e-16

Page 12: Wcre13c.pdf

RQ2: Are classes that coRQ2: Are classes that co--change change with antiwith anti--patterns more faultpatterns more fault--prone prone

than other classes?than other classes?

Classes co-changing with AP 241 102

Classes co-changing with AP and that are not AP 120 59

Other classes 1502 1480

Classes co-changing with AP 68 26

Classes co-changing with AP and that are not AP 33 10

Other classes 674 847

Classes co-changing with AP 37 21Classes co-changing with AP and that are not AP 20 12

Other classes 534 599

Faults No-Faults Odd RatiosTotal of classes co-changing with AP 346 149 2.5

Classes co-changing with AP and that are not AP 173 81 2.3Total of other classes 2710 2926 1

P-value = 2.2 e-16

Page 13: Wcre13c.pdf

13

We found no class having a static dependency (i.e. use, association, aggregation, and composition relationships) or that co-changed with a SpaghettiCode.

We found that classes having static relationships with Blob, ComplexClass, and SwissArmyKnife are significantly more fault prone than other classes with similar complexity, change history, and code size.

Many anti-patterns’ relationships were with classes playing roles in design patterns.

Some ObservationsSome Observations

Classes that are co-changing with anti-patterns classes are significantly more fault prone than other classes with similar

complexity, change history, and code size.

Page 14: Wcre13c.pdf

14