ARIES: An Eclipse plug-in to Support Extract Class Refactoring Gabriele Bavota # , Andrea De Lucia * , Andrian Marcus ❊ Rocco Oliveto ✢ , Fabio Palomba * , Michele Tufano * * University of Salerno, Italy ❊ Wayne State University, USA ✢ University of Molise, Italy # University of Sannio, Italy 8th Italian Workshop on Eclipse Technologies, Crema 19/09/2013 sabato 14 settembre 13
50
Embed
ARIES: An Eclipse Plug-in To Support Extract Class Refactoring
During software evolution changes are inevitable. These changes may lead to design erosion and the introduction of inadequate design solutions, such as design antipatterns. Several empirical studies provide evidence that the presence of antipatterns is generally associated with lower productivity, greater rework, and more significant design efforts for developers. In order to improve the quality and remove antipatterns, refactoring operations are needed. In this demo, we present the Extract class features of ARIES (Automated Refactoring In EclipSe), an Eclipse plug-in that supports the software engineer in removing the “Blob” antipattern.
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
ARIES: An Eclipse plug-in to Support Extract Class RefactoringGabriele Bavota#, Andrea De Lucia*, Andrian Marcus❊
Rocco Oliveto✢, Fabio Palomba*, Michele Tufano*
*University of Salerno, Italy❊Wayne State University, USA✢University of Molise, Italy
#University of Sannio, Italy
8th Italian Workshop on Eclipse Technologies, Crema19/09/2013
sabato 14 settembre 13
Refactoring Software Systems: why?
Extract Class Refactoring
ARIES: Automated Refactoring In EclipSe
A Graph-theory based method for Extract Class Refactoring
Context
ClassClass
Class
Supporting Extract Class Refactoring in Eclipse
sabato 14 settembre 13
Refactoring Software SystemsContext
sabato 14 settembre 13
CohesionCoupling
W. Stevens, G. Myers, and L. Constantine. Structured Design.
IBM Systems Journal, 13(2): 115 - 139, 1974
sabato 14 settembre 13
sabato 14 settembre 13
Tibor Gyimóthy, Rudolf Ferenc, and István Siket. Empirical validation of object-oriented metrics on open source software for fault prediction. IEEE Transactions on Software Engineering (TSE), 2005.
M. Abbes, F. Khomh, Y.-G. Guéhéneuc, and G. Antoniol. An empirical study of the impact of two antipatterns, blob and spaghetti code, on program comprehension. European Conference on Software Maintenance and Reengineering, CSMR 2011.
L. C. Briand, J. Wüst, J. W. Daly, and V. D. Porter. Exploring the relationship between design measures and software quality in object- oriented systems. Journal of Systems and Software (JSS), 2000.
Restructuring... why?ProducvyCompnsibily# Defect
sabato 14 settembre 13
Refactoring is...“Refactoring is a disciplined technique for restructuring an
existing body of code, improving its non-functional attributes without changing its external behavior.”
sabato 14 settembre 13
sabato 14 settembre 13
BLOB
sabato 14 settembre 13
Splitting a class having many responsibilities into different classes
InputClass C
BLOB
Class C1Output
Class C2
cohesion = 0.2 cohesion = 0.5 cohesion = 0.4
Extract Class Refactoring
sabato 14 settembre 13
How?
InputClass C
BLOB
Class C1Output
Class C2
cohesion = 0.2 cohesion = 0.5 cohesion = 0.4
Extract Class Refactoring
sabato 14 settembre 13
ClassClass
Class
A Graph-theory based method for Extract Class Refactoring
G. Bavota, A. De Lucia, A. Marcus, and R. Oliveto.Automating Extract Class Refactoring: an Improved Method and its Evaluation.
Empirical Software Engineering (EMSE), 2013
sabato 14 settembre 13
GRAPH theory-based
sabato 14 settembre 13
GRAPH theory-basedClass C
BLOBmethod-by-methodmatrix construction
m1 m2 ........ mnm1m2........mn
n methods
sabato 14 settembre 13
GRAPH theory-basedClass C
BLOBmethod-by-methodmatrix construction
m1 m2 ........ mnm1m2........mn
SSM CIM CSMStructural Similarity
between MethodsCall-based Interaction
between MethodsConceptual Similarity
between Methods
n methods
sabato 14 settembre 13
GRAPH theory-basedClass C
BLOBmethod-by-methodmatrix construction
m1 m2 ........ mnm1m2........mn
SSM CIM CSMStructural Similarity
between MethodsCall-based Interaction
between MethodsConceptual Similarity
between Methods
n methods
ci,j = wSSM · SSM + wCIM · CIM + wCSM · CSM
sabato 14 settembre 13
GRAPH theory-basedm1 m2 ........ mn
m1m2........mn
method-by-method matrixfiltering and transitive closure
0.8
0.70.5
0.70.6
Chain 1
Chain 2Chain 3
sabato 14 settembre 13
GRAPH theory-basedm1 m2 ........ mn
m1m2........mn
method-by-method matrixfiltering and transitive closure
0.8
0.70.5
0.70.6
Chain 1
Chain 2Chain 3
sabato 14 settembre 13
GRAPH theory-basedm1 m2 ........ mn
m1m2........mn
method-by-method matrixfiltering and transitive closure
0.8
0.70.5
0.70.6
Chain 1
Chain 2Chain 3
0.8
0.70.5
0.70.6
Chain 1
Chain 2Chain 3
merging trivialchains
Chain 1
Candidate Class 1
Chain 2Chain 3
Candidate Class 2
sabato 14 settembre 13
Metric basedevaluation
sabato 14 settembre 13
sabato 14 settembre 13
Considered Metrics
sabato 14 settembre 13
Considered Metrics
Lack of Cohesion of Methods (LCOM)The pairs of methods in a class do not sharing any attribute
sabato 14 settembre 13
Considered Metrics
Lack of Cohesion of Methods (LCOM)The pairs of methods in a class do not sharing any attributeConceptual Cohesion of Classes (C3)Semantic similarity between methods of a class
sabato 14 settembre 13
Considered Metrics
Lack of Cohesion of Methods (LCOM)The pairs of methods in a class do not sharing any attributeConceptual Cohesion of Classes (C3)Semantic similarity between methods of a classMessage Passing Coupling (MPC)The number of calls between a pair of classes
sabato 14 settembre 13
Considered Metrics
Lack of Cohesion of Methods (LCOM)
Conceptual Cohesion of Classes (C3)
Message Passing Coupling (MPC)
The pairs of methods in a class do not sharing any attribute
Semantic similarity between methods of a class
The number of calls between a pair of classes
sabato 14 settembre 13
Considered Metrics
+82%Lack of Cohesion of Methods (LCOM)
Conceptual Cohesion of Classes (C3)
Message Passing Coupling (MPC)
The pairs of methods in a class do not sharing any attribute
Semantic similarity between methods of a class
The number of calls between a pair of classes
sabato 14 settembre 13
Considered Metrics
+82%+105%
Lack of Cohesion of Methods (LCOM)
Conceptual Cohesion of Classes (C3)
Message Passing Coupling (MPC)
The pairs of methods in a class do not sharing any attribute
Semantic similarity between methods of a class
The number of calls between a pair of classes
sabato 14 settembre 13
Considered Metrics
+82%+105%+3%
Lack of Cohesion of Methods (LCOM)
Conceptual Cohesion of Classes (C3)
Message Passing Coupling (MPC)
The pairs of methods in a class do not sharing any attribute
Meaningfulness of the suggested refactoring operations
Objects17 Blobs used in the metric-based evaluation
What we askedAgreement to the claim: “The proposed refactoring results in a better division of responsibilities”
Five point Likert scale: “1: Strongly disagree; 2: Disagree; 3: Neutral; 4: Agree; 5: Fully agree”
sabato 14 settembre 13
5
4
3
2
1
approach random approach randomGanttProject Xerces
sabato 14 settembre 13
5
4
3
2
1
approach random approach randomGanttProject Xerces
Average Score4.3
sabato 14 settembre 13
More qualitative feedback
sabato 14 settembre 13
Subjects15 Master’s students
Objects11 Blobs refactored by original developers
What we askedWould you split this class?
if YES:i. Why? ii. Would you split the class differently than the provided refactoring solution? Why? iii. Did you find the provided refactoring solution useful as starting point to perform your refactoring? Why?
if NO:i. Why?:
sabato 14 settembre 13
sabato 14 settembre 13
Usefulness of the provided refactoring1. it eases code comprehension; 2. it highlights the main responsibilities implemented in a class; 3. the extracted classes are cohesive.
sabato 14 settembre 13
Usefulness of the provided refactoring1. it eases code comprehension; 2. it highlights the main responsibilities implemented in a class; 3. the extracted classes are cohesive.
“without the refactoring suggestion it would be too difficult to identify the main responsibilities of the classes”
sabato 14 settembre 13
MoJoFM between refactorings performed by students and those by the original
developers
93%sabato 14 settembre 13
sabato 14 settembre 13
DEMO
sabato 14 settembre 13
Conclusions & Future work
sabato 14 settembre 13
...conclusion...
G. Bavota, A. De Lucia, A. Marcus, R. Oliveto, and F. Palomba. Supporting Extract Class Refactoring in Eclipse: The ARIES Project.
In Proceedings of the 34th International Conference on Software Engineering (ICSE 2012), Zurich, Switzerland, 2012. IEEE Press. Formal Tool Demo. pp. 1419-1422
sabato 14 settembre 13
...future work...
implement other refactoring operations,and more sophisticated approaches to detect Blobs