Top Banner
ICSM2008BEIJING An Empirical Study of the Relationships between Design Pattern Roles and Class Change Proneness Massimiliano DiPenta - University of Sannio Luigi Cerulo - University of Sannio Yann-Gaël Guéhéneuc - Université de Montréal Giuliano Antoniol - École Polytechnique de Montréal ICSM2008BEIJING
20
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: ICMS08b.ppt

ICSM2008BEIJING

An Empirical Study of the Relationships between

Design Pattern Roles and Class Change Proneness

Massimiliano DiPenta - University of SannioLuigi Cerulo - University of SannioYann-Gaël Guéhéneuc - Université de MontréalGiuliano Antoniol - École Polytechnique de Montréal

ICSM2008BEIJING

Page 2: ICMS08b.ppt

ICSM2008BEIJING

Outline

IntroductionWhat is a design pattern role

Research questionsThe aim of the work

Data extraction processHow we extract the dataset

ResultsWhat we observed

Page 3: ICMS08b.ppt

ICSM2008BEIJING

Design Pattern Role, What Is It?

Class A

Design pattern

Class B Class C Class D

Role c Role b

Role a Composite patternComponent

CompositeLeaf

Page 4: ICMS08b.ppt

ICSM2008BEIJING

Class A

Observer pattern

Class C Class D

Concrete observerConcrete subject

Subject

Observer

Class B

Design Pattern Role, What Is It?

Page 5: ICMS08b.ppt

ICSM2008BEIJING

In Real Systems…

ArgoUML

Page 6: ICMS08b.ppt

ICSM2008BEIJING

DeMINA– Ptidej Tool Suite

A Multi-layered Framework for Design Pattern Identification[Y.G. Guéhéneuc and G. Antoniol, to appear in the September/October 2008 issue of TSE]

Able to detect roles in 12 DP:Abstract Factories, Adapters, Commands,

Composites, Decorators, Factory Methods, Observers,

Prototypes, Singletons, State/Strategies, Template methods,

Visitors

Precision = 34%, recall = 100%

Page 7: ICMS08b.ppt

ICSM2008BEIJING

What We Are Interested In

What happens in

real software projects?

Page 8: ICMS08b.ppt

ICSM2008BEIJING

Research Questions

… it is known that design pattern classes are less change and fault prone…

Inside a design patternRQ1 – Which roles are more likely to change?

RQ2 – Which kind of change is more likely to predominate?

Page 9: ICMS08b.ppt

ICSM2008BEIJING

A versioned software system can be viewed as a sequence of snapshots generated by a sequenceof change sets

S1 S2 S3 Sn

Change set 2-3

commit of B1.5 G1.6

Change set 2-3

commit of B1.5 G1.6

Heuristic: commits that share the same author, branch and notesand their distance is < 200 s. [Zimmermann et al. ICSE 04]

Heuristic: commits that share the same author, branch and notesand their distance is < 200 s. [Zimmermann et al. ICSE 04]

Data We Have Extracted

Change set 1-2

commit of B1.4 G1.5 F1.1

Change set 1-2

commit of B1.4 G1.5 F1.1

Page 10: ICMS08b.ppt

ICSM2008BEIJING

Methodaddition and removal

Detection of Structural Changes

Class X Class X

S1 S2 S3 Sn

compare

M

Attributeaddition and removal

A

Class imple-mentationchanges

I

Classhierarchychanges

H

Page 11: ICMS08b.ppt

ICSM2008BEIJING

Data Set #1Kind of Changes

I,HMMC4

A,HC3

A,HC2

M,IM,AC1

Sn…S5S4S3S2S1

Snapshots

Cla

sses

Page 12: ICMS08b.ppt

ICSM2008BEIJING

Data Set #2Design Pattern Roles

Observer(observer)

Factory(concrete creator)

Decorator(concrete component)

C3

Observer (subject)Factory(creator)C2

Composite (leaf)

Decorator (Component)C1

…#3#2#1

Design pattern instances

Cla

sses

Page 13: ICMS08b.ppt

ICSM2008BEIJING

Back to Research Questions

Which roles are more likely to change?Counts of class changes grouped by design pattern roles

5����������������C4 (Composite#1-leaf)

1����C3 (Observer#2-subject)

4����������������C2 (Observer#1-observer)

2��������C1 (Observer#1-subject)

#…S5S4S3S2S1Classes

Page 14: ICMS08b.ppt

ICSM2008BEIJING

Back to Research Questions

Which kind of change is more likely topredominate?

Counts of class changes groupsed by design pattern roles and change type

-

-

-

2

#M

1

1

3

-

# I

4

-

1

1

#H

1H,AH,IHHC4 (Composite#1-leaf)

-IC3 (Observer#2-subject)

3M,IA,IA,HA,IC2 (Observer#1-observer)

-M,HMC1 (Observer#1-subject)

#A…S5S4S3S2S1Classes

Page 15: ICMS08b.ppt

ICSM2008BEIJING

Results, What We Have Observed

Analyzed systemsJHotDraw (177 change sets)

Xerces-j (4972 change sets)

Eclipse JDT (23424 change sets)

Analyzed design patternsAbstract Factories, Adapters, Commands,

Composites, Decorators, Factory Methods, Observers,

Prototypes, Singletons, State/Strategies, Template methods,

Visitors

Page 16: ICMS08b.ppt

ICSM2008BEIJING

Abstract Factory

CONFIRMED

JHotDraw

Page 17: ICMS08b.ppt

ICSM2008BEIJING

Template Method

CONFIRMED

Eclipse-JDT

Page 18: ICMS08b.ppt

ICSM2008BEIJING

Composite

Eclipse-JDT

Partially

CONFIRMED

Page 19: ICMS08b.ppt

ICSM2008BEIJING

Conclusions

This study is not yet concludedMany other questions still to answer…

Main issues to overcomeDesign pattern detection (e.g., other languages than Java)

Change type detection (e.g., class relationship change)

Page 20: ICMS08b.ppt

ICSM2008BEIJING

questions

ا�����

въпроси

dotazy

问题

問題

질문

pitanja

spørgsmål

kysymyksiä

questions

質問

ερωτήσεις

सवाल

domande

spørsmål

vragen

pytania

Perguntas

întrebări

preguntas frågor

Fragen

вопросы