Upload
vananh
View
213
Download
0
Embed Size (px)
Citation preview
An experience report on using code smells detection tools
Francesca Arcelli Fontana Elia Mariani
Andrea Morniroli Raul Sormani Alberto Tonello
RefTestndash May 25 2011
Berlin
Universitagrave degli Studi di Milano ndash Bicocca
DISCo ndash Dipartimento di Informatica Sistemistica e Comunicazione
Outline
bull Code smells and refactoring
bull Code smells detection tools
bull Experiment set up
bull Experiment results
bull Lessons learned
bull Future developments
25-03-2011 An experience report on using code smells
detection tools
Code smells and Refactoring
bull Smells characteristics of software that may indicate a design problem [Fowler 99]
bull Taxonomies [Wake03 Mantyla 03 Keriesky 04 Lanza 06 Moha 10]
bull Refactoring a disciplined technique for restructuring an existing body of code Refactoring alters the internal structure of code without changing its behavior
bull A smell is a symptom refactoring is a cure
bull Use the right refactoring for the right issue
ndash A same symptom may have different cures
ndash Thus every smell may suggests more than one refactoring
25-03-2011
An experience report on using code smells detection tools
Code smells and Refactoring
ndash Not necessarily all the code smells have to be removed
ndash It is better to remove them as early as possible Tool support is important since many code smells can go unnoticed while programmers are working
ndash Code smells are not formally defined hence their detection can provide uncertain and unsafe results (tailoring of the definitions)
ndash The detection techniques used by the tools are usually based on the computation of a particular set of combined metrics or standard object-oriented metrics or metrics defined ad hoc for the smell detection purpose (define the threshold values for these metrics)
ndash The aim with detection strategies is to make design rules (and their violations) quantifiable and thus to be able to detect design problems in an object-oriented software system ie to find those design fragments that are affected by a particular design problem
25-03-2011 An experience report on using code smells
detection tools
Code smell detection tools
bull JDeodorant Feature Envy God Class Long Method Type Checking bull PMD Long Method Large Class Long Parameter List Duplicate Code
Dead Code bull Stench Blossom Data Clumps Long Method Large Class Feature Envy
Message Chain (8 smells detecting by reading the code) bull iPlasma Brain Class Brain Method Data Class Feature Envy God Class
Extensive Coupling Feature Envy God Class bull inFusion Brain method Data Class Feature Envy God Class Refused
Parent Bequest Significant Duplication
bull Decor Lazy Class Long Method Large Class Long Parameter List Refused Bequest Speculative Generality Message Chains Data Class Tradition Breaker (29 code and design smells)
bull CheckStyle Long Method Long parameter list Large Class DuplCode bull Codecity Feature Envy Brain Class God Class Data Class Brain Method
Intensive Coupling Dispersed Coupling Shotgun Surgery
bull CodeVizard God Class Shotgun Surgery
25-03-2011
An experience report on using code smells detection tools
Considerations on code smell detection tools
bull Automatic Reafactoring Jdeodorant
bull Link to the Code Jdeodorant PMD Stench Blossom JDeodorant
bull Other languages (Java) InFusion(C C++) iPlasma (C++)
bull System size computation
bull Forward engineering(development) Stench Blossom
bull Computation of the number of the smells Stench Blossom does not provide numerical values but only a visual threshold the size of a petal is directly proportional to the entity of the code smells The only possible procedure to find code smells is to manually browse the source code looking for a petal whose size is big enough to make us suppose that there is a code smell
25-03-2011 An experience report on using code smells
detection tools
Detecting smells and Metrics computation
bull How to fix thresholds of the metrics bull Define for each metric a filter that captures best the symptom that the metric is
intended to quantify ndash (1) pick-up a comparator and ndash (2) to set an adequate threshold in conformity with its semantics
bull Setting thresholds can be an effective approach for detecting domain-specific code smells The healthiness of a module in a domain may depend on the semantic information it has such as the functionality or the logic that the module implements For example
bull Brain Method smell is a method that contains too many conditional branches Although there are design solutions that can reduce the use of conditional branches they may not satisfy other design constraints In some cases using conditional branches can be the best choice among the design alternatives
bull Intensive coupling but the ldquothe coupling degree of a methodrdquo can be considered acceptable for the system in a specific domain In other words we can think that such degree of coupling would not cause maintenance problems
25-03-2011 An experience report on using code smells
detection tools
Experiment set up
110 1101 1102 1103 1111
Packages 27 27 27 28 33
Classes 393 395 396 402 549
Methods 1913 1921 1924 1937 2724
25-03-2011 An experience report on using code smells
detection tools
GanttProject System
No standard benchmark for toolrsquos comparison is available
the authors of DECOR provided the precision and recall of a
detection technique on an open-source system (multi application
platform for planning and project management) and on a
representative set of six smells
Manual validation could be subjective
Experiment results- God Class
bull The Code smell Large Class detected by DECOR is equivalent to the God Class smell recognized by JDeodorant inFusion and iPlasma In fact both specifications define classes that are trying to do too much These classes also have low cohesion
1 They heavily access data of other simpler classes either directly or using accessor methods
2 They are large and complex
3 They have a lot of non-communicative behavior ie there is a low cohesion between the methods belonging to that class
25-03-2011 An experience report on using code smells
detection tools
God Class detection
1 Class uses directly more than a few attributes of other classes Since ATFD (Access to Foreign Data) measures how many foreign attributes are
used by the class it is clear that the higher the ATFD value for a class the higher is the probability that a class is (or is about to become) a God Class (the extent to which a class uses attributes of other classes)
ATFD gt a maximun number of tolerable foreign attributes to be used (FEW where FEW is considered as [2-5])
2 Functional complexity of the class is very high This is expressed using the WMC (Weighted Method Count) metric sum of the
statical complexity of all methods in a class (consider McCabersquos cyclomatic complexity metric as a complexity measure GREATER THAN VERY HIGH
3 Class cohesion is low As a God Class performs several distinct functionalities involving disjunct sets of attributes this has a negative impact on the classrsquos cohesion
Tight Class Cohesion (TCC) is the relative number of methods directly connected via accesses of attributes LESS than13 ([033]) less than one-third of the method pairs have in common the usage of the same attribute
25-03-2011 An experience report on using code smells
detection tools
Experiment results
bull As an example the following expression evaluates if the ldquoGod classrdquo smell is present
(WMCge 47) and (ATFD gt 5) and (TCC lt1 3)
bull where WMC weighted methods per class ATFD number of accesses to foreign class data and TCC tight class cohesion
bull For Jdeodorant the God Class is detected considering the number of line of code
25-03-2011 An experience report on using code smells
detection tools
Metrics theresholds examples -iPlasma
Metric LOW AVE HIGH VERY HIGH
LOCClass 28 70 130 195
WMC 5 14 31 47
LOCMethod 7 10 13 19
NOMClass 4 7 10 15
25-03-2011 An experience report on using code smells
detection tools
Experiment results
25-03-2011 An experience report on using code smells
detection tools
bull God Class Decor-Benchmark 9 God class
Table 9 God Class comparisons
110 1101 1102 1103 1111
JDeodorant 7 (178) 6 (151) 8 (202) 5 (124) 22 (403)
InFusion 11 (279)
11 (278)
11 (277)
11 (273)
13 (238)
iPlasma 10 (254)
10 (253)
10 (252)
10 (248)
13 (238)
Experiment results-Long Parameter List
bull PMD 65 LPL with 4 parameter (DECOR 54 LPL)
25-03-2011 An experience report on using code smells
detection tools
0
10
20
30
40
50
60
70
80
90
1100 1101 1102 1103 1111
Long Parameter list Comparison
PMD - TH 4 parameters
PMD - TH 5 parameters
Experiment results-Large Class
bull PMD ndash Line of code 415 (DECOR-9 Large Class)
25-03-2011 An experience report on using code smells
detection tools
0
2
4
6
8
10
12
14
16
1100 1101 1102 1103 1111
sm
ells
Large class
Threshold 1000
Threshold 800
Threshold 600
Threshold 500
Threshold 450
Threshold 415
Threshold 400
Experiment results-Code smell evolution
-
25-03-2011 An experience report on using code smells
detection tools
Lesson learned
bull A comparison of the tools is a complex task
ndash Computing the size of the system detection techniques the metrics theresholds refactoring link to the code tool interface
bull We aim to propose a new taxonomy of smells based on refinements of smells definition clear definition of the detection techniques (necessary and sufficient conditions)
bull We gained useful information to be exploited in a tool for code smell detection
25-03-2011 An experience report on using code smells
detection tools
MARPLE
25-03-2011 An experience report on using code smells
detection tools
Marple-Code smells Detector
Currently we are able to detect the following smells
1) Feature Envy (Jdeodorant iPlasma inFusion Marple)
2) Indecent Exposure (Marple)
3) Long Parameter List (Checkstyle PMD iPlasma Marple)
4) Refused Bequest (iPlasma Marple)
5) Data Class (iPlasma inFusion Marple)
6) Lazy Class (Marple)
Future smells to detect
Comments Duplicate Code
We are interested to provide the same validation for precisionrecall on GanttProject system 25-03-2011
An experience report on using code smells detection tools
Future works
bull Extend the manual validation for other smells to improve comparison
bull Extend the experimentation with other tools as CodeVizard Checkstyleand on different system as Ant
bull Improve the Marple Code Smell Detector tool through the lessons learned in particular
bull provide a clear detection technique and clear metrics theresholds
bull provide a metrics-based approach that incorporates tailored domain-specific detection rules
bull Analyze the impact of refactoring to remove code smells on some well known object-oriented quality metrics [Arcelli Spinelli WRT 2011 ICSE Workshop]
25-03-2011 An experience report on using code smells
detection tools
Future works-Impact of Refactoring
bull Our approach is based on the following steps 1 computing the metrics on a software system
2 detecting the code smell
3 automated refactoring for one smell
4 reapplying step 1
5 analysing the incrementdecrement for each metric value
6 reapplying step 3-5 for each smell
7 identifying the smells whose refactoring better improves the quality of the analysed system
bull We have considered metrics proposed in the literature to measure cohesion coupling and complexity of a system
bull We considered Feature Envy Long Method Shotgun Surgery Large Class
25-03-2011 An experience report on using code smells
detection tools
References
bull [1] F Arcelli M Zanoni ACaracciolo A benchmark platform for design patterns detection Procceedings of the PATTERNS 2010 Conference Lisboa Portugal November 2010
bull [2] F Arcelli M Zanoni A Tool for Design Pattern Detection and Software Architecture Reconstruction Information Sciences Elsevier doi101016jins2010
bull [3] CS-CheckStyle httpcheckstylesourceforgenetindexhtml
bull [4] Martin Fowler Refactoring Improving the Design of Existing Code Addison-Wesley Inc Boston MA USA 1999
bull [5] Hamza H Counsell S Hall T and Loizou G Code smell eradication and associated refactoring 2nd European Computing Conference 2008
bull [6] YGil I Maman Micro Patterns in Java Code Proc of the 20th annual ACM SIGPLAN conference OOPSLA 2005 October 2005
bull [7] M Lanza and R Marinescu Object-Oriented Metrics in Practice Springer-Verlag 2006
bull [8] InCode httpwwwintooituscominCodehtml
bull [9] InFusion httpwwwintooituscominFusionhtml
bull [10] iPlasma httplooseuptroiplasmaindexhtml
bull [11] Mika V Maumlntylauml Jari Vanhanen and Casper Lassenius Bad smells ndash humans as code critics Proc IEEE International Conference on Software Maintenance 0399ndash408 2004
bull [12] T Mens T Tourweacute A Survey of Software Refactoring IEEE Transactions on Software Engineering vol 30 no 2 2004
25-03-2011 An experience report on using code smells
detection tools
References
bull [13] Naouel MohaYann-Gael Gueheneuc Laurence Duchien Anne-Francoise Le Meur Decor a method for the specificatio and detection of code and design smells TSE IEEE CS Press 2010
bull [14] Naouel Moha Yann-Gael Guacuteehacuteeneuc Anne-Francoise Le MeurLaurence Duchien and Alban Tiberghien From a domain analysis to the specification and detection of code and design smells Formal Aspects of Computng 2009
bull [15] Emerson Murphy-Hill Chris Parnin and Andrew P Blac How we refactor and how we know it In ICSE rsquo09 Proceedings of the 31st International Conference on Software Engineering 2009
bull [16] Emerson Murphy-Hill and Andrew P Black An interactive ambient visualization for code smells Proceedings of SOFTVIS 10 USA October 2010
bull [17] C Marinescu R Marinescu P Mihancea D Ratiu and R Wettel iplasma An integrated platform for quality assessment of object-oriented design In Proceedings of 21st International Conference on Software Maintenance (ICSM 2005) Tools Section 2005
bull [18] Steffen Olbrich Daniela Cruzes Victor Basili Nico Zazworka CodeVizardA tool to aid the analysis of software evolution Proceedings ICSE 2010 South Africa
bull [19] PMD httppmdsourceforgenet
bull [20] httpesserediscounimibitreverseCodeSmells html
bull [21] Nikolaos Tsantalis Theodoros Chaikalis and Alexander Chatzigeorgiou JDeodorant Identification and removal of type-checking bad smells In Proceedings of CSMR 2008 pp 329ndash331
bull
25-03-2011 An experience report on using code smells
detection tools
Outline
bull Code smells and refactoring
bull Code smells detection tools
bull Experiment set up
bull Experiment results
bull Lessons learned
bull Future developments
25-03-2011 An experience report on using code smells
detection tools
Code smells and Refactoring
bull Smells characteristics of software that may indicate a design problem [Fowler 99]
bull Taxonomies [Wake03 Mantyla 03 Keriesky 04 Lanza 06 Moha 10]
bull Refactoring a disciplined technique for restructuring an existing body of code Refactoring alters the internal structure of code without changing its behavior
bull A smell is a symptom refactoring is a cure
bull Use the right refactoring for the right issue
ndash A same symptom may have different cures
ndash Thus every smell may suggests more than one refactoring
25-03-2011
An experience report on using code smells detection tools
Code smells and Refactoring
ndash Not necessarily all the code smells have to be removed
ndash It is better to remove them as early as possible Tool support is important since many code smells can go unnoticed while programmers are working
ndash Code smells are not formally defined hence their detection can provide uncertain and unsafe results (tailoring of the definitions)
ndash The detection techniques used by the tools are usually based on the computation of a particular set of combined metrics or standard object-oriented metrics or metrics defined ad hoc for the smell detection purpose (define the threshold values for these metrics)
ndash The aim with detection strategies is to make design rules (and their violations) quantifiable and thus to be able to detect design problems in an object-oriented software system ie to find those design fragments that are affected by a particular design problem
25-03-2011 An experience report on using code smells
detection tools
Code smell detection tools
bull JDeodorant Feature Envy God Class Long Method Type Checking bull PMD Long Method Large Class Long Parameter List Duplicate Code
Dead Code bull Stench Blossom Data Clumps Long Method Large Class Feature Envy
Message Chain (8 smells detecting by reading the code) bull iPlasma Brain Class Brain Method Data Class Feature Envy God Class
Extensive Coupling Feature Envy God Class bull inFusion Brain method Data Class Feature Envy God Class Refused
Parent Bequest Significant Duplication
bull Decor Lazy Class Long Method Large Class Long Parameter List Refused Bequest Speculative Generality Message Chains Data Class Tradition Breaker (29 code and design smells)
bull CheckStyle Long Method Long parameter list Large Class DuplCode bull Codecity Feature Envy Brain Class God Class Data Class Brain Method
Intensive Coupling Dispersed Coupling Shotgun Surgery
bull CodeVizard God Class Shotgun Surgery
25-03-2011
An experience report on using code smells detection tools
Considerations on code smell detection tools
bull Automatic Reafactoring Jdeodorant
bull Link to the Code Jdeodorant PMD Stench Blossom JDeodorant
bull Other languages (Java) InFusion(C C++) iPlasma (C++)
bull System size computation
bull Forward engineering(development) Stench Blossom
bull Computation of the number of the smells Stench Blossom does not provide numerical values but only a visual threshold the size of a petal is directly proportional to the entity of the code smells The only possible procedure to find code smells is to manually browse the source code looking for a petal whose size is big enough to make us suppose that there is a code smell
25-03-2011 An experience report on using code smells
detection tools
Detecting smells and Metrics computation
bull How to fix thresholds of the metrics bull Define for each metric a filter that captures best the symptom that the metric is
intended to quantify ndash (1) pick-up a comparator and ndash (2) to set an adequate threshold in conformity with its semantics
bull Setting thresholds can be an effective approach for detecting domain-specific code smells The healthiness of a module in a domain may depend on the semantic information it has such as the functionality or the logic that the module implements For example
bull Brain Method smell is a method that contains too many conditional branches Although there are design solutions that can reduce the use of conditional branches they may not satisfy other design constraints In some cases using conditional branches can be the best choice among the design alternatives
bull Intensive coupling but the ldquothe coupling degree of a methodrdquo can be considered acceptable for the system in a specific domain In other words we can think that such degree of coupling would not cause maintenance problems
25-03-2011 An experience report on using code smells
detection tools
Experiment set up
110 1101 1102 1103 1111
Packages 27 27 27 28 33
Classes 393 395 396 402 549
Methods 1913 1921 1924 1937 2724
25-03-2011 An experience report on using code smells
detection tools
GanttProject System
No standard benchmark for toolrsquos comparison is available
the authors of DECOR provided the precision and recall of a
detection technique on an open-source system (multi application
platform for planning and project management) and on a
representative set of six smells
Manual validation could be subjective
Experiment results- God Class
bull The Code smell Large Class detected by DECOR is equivalent to the God Class smell recognized by JDeodorant inFusion and iPlasma In fact both specifications define classes that are trying to do too much These classes also have low cohesion
1 They heavily access data of other simpler classes either directly or using accessor methods
2 They are large and complex
3 They have a lot of non-communicative behavior ie there is a low cohesion between the methods belonging to that class
25-03-2011 An experience report on using code smells
detection tools
God Class detection
1 Class uses directly more than a few attributes of other classes Since ATFD (Access to Foreign Data) measures how many foreign attributes are
used by the class it is clear that the higher the ATFD value for a class the higher is the probability that a class is (or is about to become) a God Class (the extent to which a class uses attributes of other classes)
ATFD gt a maximun number of tolerable foreign attributes to be used (FEW where FEW is considered as [2-5])
2 Functional complexity of the class is very high This is expressed using the WMC (Weighted Method Count) metric sum of the
statical complexity of all methods in a class (consider McCabersquos cyclomatic complexity metric as a complexity measure GREATER THAN VERY HIGH
3 Class cohesion is low As a God Class performs several distinct functionalities involving disjunct sets of attributes this has a negative impact on the classrsquos cohesion
Tight Class Cohesion (TCC) is the relative number of methods directly connected via accesses of attributes LESS than13 ([033]) less than one-third of the method pairs have in common the usage of the same attribute
25-03-2011 An experience report on using code smells
detection tools
Experiment results
bull As an example the following expression evaluates if the ldquoGod classrdquo smell is present
(WMCge 47) and (ATFD gt 5) and (TCC lt1 3)
bull where WMC weighted methods per class ATFD number of accesses to foreign class data and TCC tight class cohesion
bull For Jdeodorant the God Class is detected considering the number of line of code
25-03-2011 An experience report on using code smells
detection tools
Metrics theresholds examples -iPlasma
Metric LOW AVE HIGH VERY HIGH
LOCClass 28 70 130 195
WMC 5 14 31 47
LOCMethod 7 10 13 19
NOMClass 4 7 10 15
25-03-2011 An experience report on using code smells
detection tools
Experiment results
25-03-2011 An experience report on using code smells
detection tools
bull God Class Decor-Benchmark 9 God class
Table 9 God Class comparisons
110 1101 1102 1103 1111
JDeodorant 7 (178) 6 (151) 8 (202) 5 (124) 22 (403)
InFusion 11 (279)
11 (278)
11 (277)
11 (273)
13 (238)
iPlasma 10 (254)
10 (253)
10 (252)
10 (248)
13 (238)
Experiment results-Long Parameter List
bull PMD 65 LPL with 4 parameter (DECOR 54 LPL)
25-03-2011 An experience report on using code smells
detection tools
0
10
20
30
40
50
60
70
80
90
1100 1101 1102 1103 1111
Long Parameter list Comparison
PMD - TH 4 parameters
PMD - TH 5 parameters
Experiment results-Large Class
bull PMD ndash Line of code 415 (DECOR-9 Large Class)
25-03-2011 An experience report on using code smells
detection tools
0
2
4
6
8
10
12
14
16
1100 1101 1102 1103 1111
sm
ells
Large class
Threshold 1000
Threshold 800
Threshold 600
Threshold 500
Threshold 450
Threshold 415
Threshold 400
Experiment results-Code smell evolution
-
25-03-2011 An experience report on using code smells
detection tools
Lesson learned
bull A comparison of the tools is a complex task
ndash Computing the size of the system detection techniques the metrics theresholds refactoring link to the code tool interface
bull We aim to propose a new taxonomy of smells based on refinements of smells definition clear definition of the detection techniques (necessary and sufficient conditions)
bull We gained useful information to be exploited in a tool for code smell detection
25-03-2011 An experience report on using code smells
detection tools
MARPLE
25-03-2011 An experience report on using code smells
detection tools
Marple-Code smells Detector
Currently we are able to detect the following smells
1) Feature Envy (Jdeodorant iPlasma inFusion Marple)
2) Indecent Exposure (Marple)
3) Long Parameter List (Checkstyle PMD iPlasma Marple)
4) Refused Bequest (iPlasma Marple)
5) Data Class (iPlasma inFusion Marple)
6) Lazy Class (Marple)
Future smells to detect
Comments Duplicate Code
We are interested to provide the same validation for precisionrecall on GanttProject system 25-03-2011
An experience report on using code smells detection tools
Future works
bull Extend the manual validation for other smells to improve comparison
bull Extend the experimentation with other tools as CodeVizard Checkstyleand on different system as Ant
bull Improve the Marple Code Smell Detector tool through the lessons learned in particular
bull provide a clear detection technique and clear metrics theresholds
bull provide a metrics-based approach that incorporates tailored domain-specific detection rules
bull Analyze the impact of refactoring to remove code smells on some well known object-oriented quality metrics [Arcelli Spinelli WRT 2011 ICSE Workshop]
25-03-2011 An experience report on using code smells
detection tools
Future works-Impact of Refactoring
bull Our approach is based on the following steps 1 computing the metrics on a software system
2 detecting the code smell
3 automated refactoring for one smell
4 reapplying step 1
5 analysing the incrementdecrement for each metric value
6 reapplying step 3-5 for each smell
7 identifying the smells whose refactoring better improves the quality of the analysed system
bull We have considered metrics proposed in the literature to measure cohesion coupling and complexity of a system
bull We considered Feature Envy Long Method Shotgun Surgery Large Class
25-03-2011 An experience report on using code smells
detection tools
References
bull [1] F Arcelli M Zanoni ACaracciolo A benchmark platform for design patterns detection Procceedings of the PATTERNS 2010 Conference Lisboa Portugal November 2010
bull [2] F Arcelli M Zanoni A Tool for Design Pattern Detection and Software Architecture Reconstruction Information Sciences Elsevier doi101016jins2010
bull [3] CS-CheckStyle httpcheckstylesourceforgenetindexhtml
bull [4] Martin Fowler Refactoring Improving the Design of Existing Code Addison-Wesley Inc Boston MA USA 1999
bull [5] Hamza H Counsell S Hall T and Loizou G Code smell eradication and associated refactoring 2nd European Computing Conference 2008
bull [6] YGil I Maman Micro Patterns in Java Code Proc of the 20th annual ACM SIGPLAN conference OOPSLA 2005 October 2005
bull [7] M Lanza and R Marinescu Object-Oriented Metrics in Practice Springer-Verlag 2006
bull [8] InCode httpwwwintooituscominCodehtml
bull [9] InFusion httpwwwintooituscominFusionhtml
bull [10] iPlasma httplooseuptroiplasmaindexhtml
bull [11] Mika V Maumlntylauml Jari Vanhanen and Casper Lassenius Bad smells ndash humans as code critics Proc IEEE International Conference on Software Maintenance 0399ndash408 2004
bull [12] T Mens T Tourweacute A Survey of Software Refactoring IEEE Transactions on Software Engineering vol 30 no 2 2004
25-03-2011 An experience report on using code smells
detection tools
References
bull [13] Naouel MohaYann-Gael Gueheneuc Laurence Duchien Anne-Francoise Le Meur Decor a method for the specificatio and detection of code and design smells TSE IEEE CS Press 2010
bull [14] Naouel Moha Yann-Gael Guacuteehacuteeneuc Anne-Francoise Le MeurLaurence Duchien and Alban Tiberghien From a domain analysis to the specification and detection of code and design smells Formal Aspects of Computng 2009
bull [15] Emerson Murphy-Hill Chris Parnin and Andrew P Blac How we refactor and how we know it In ICSE rsquo09 Proceedings of the 31st International Conference on Software Engineering 2009
bull [16] Emerson Murphy-Hill and Andrew P Black An interactive ambient visualization for code smells Proceedings of SOFTVIS 10 USA October 2010
bull [17] C Marinescu R Marinescu P Mihancea D Ratiu and R Wettel iplasma An integrated platform for quality assessment of object-oriented design In Proceedings of 21st International Conference on Software Maintenance (ICSM 2005) Tools Section 2005
bull [18] Steffen Olbrich Daniela Cruzes Victor Basili Nico Zazworka CodeVizardA tool to aid the analysis of software evolution Proceedings ICSE 2010 South Africa
bull [19] PMD httppmdsourceforgenet
bull [20] httpesserediscounimibitreverseCodeSmells html
bull [21] Nikolaos Tsantalis Theodoros Chaikalis and Alexander Chatzigeorgiou JDeodorant Identification and removal of type-checking bad smells In Proceedings of CSMR 2008 pp 329ndash331
bull
25-03-2011 An experience report on using code smells
detection tools
Code smells and Refactoring
bull Smells characteristics of software that may indicate a design problem [Fowler 99]
bull Taxonomies [Wake03 Mantyla 03 Keriesky 04 Lanza 06 Moha 10]
bull Refactoring a disciplined technique for restructuring an existing body of code Refactoring alters the internal structure of code without changing its behavior
bull A smell is a symptom refactoring is a cure
bull Use the right refactoring for the right issue
ndash A same symptom may have different cures
ndash Thus every smell may suggests more than one refactoring
25-03-2011
An experience report on using code smells detection tools
Code smells and Refactoring
ndash Not necessarily all the code smells have to be removed
ndash It is better to remove them as early as possible Tool support is important since many code smells can go unnoticed while programmers are working
ndash Code smells are not formally defined hence their detection can provide uncertain and unsafe results (tailoring of the definitions)
ndash The detection techniques used by the tools are usually based on the computation of a particular set of combined metrics or standard object-oriented metrics or metrics defined ad hoc for the smell detection purpose (define the threshold values for these metrics)
ndash The aim with detection strategies is to make design rules (and their violations) quantifiable and thus to be able to detect design problems in an object-oriented software system ie to find those design fragments that are affected by a particular design problem
25-03-2011 An experience report on using code smells
detection tools
Code smell detection tools
bull JDeodorant Feature Envy God Class Long Method Type Checking bull PMD Long Method Large Class Long Parameter List Duplicate Code
Dead Code bull Stench Blossom Data Clumps Long Method Large Class Feature Envy
Message Chain (8 smells detecting by reading the code) bull iPlasma Brain Class Brain Method Data Class Feature Envy God Class
Extensive Coupling Feature Envy God Class bull inFusion Brain method Data Class Feature Envy God Class Refused
Parent Bequest Significant Duplication
bull Decor Lazy Class Long Method Large Class Long Parameter List Refused Bequest Speculative Generality Message Chains Data Class Tradition Breaker (29 code and design smells)
bull CheckStyle Long Method Long parameter list Large Class DuplCode bull Codecity Feature Envy Brain Class God Class Data Class Brain Method
Intensive Coupling Dispersed Coupling Shotgun Surgery
bull CodeVizard God Class Shotgun Surgery
25-03-2011
An experience report on using code smells detection tools
Considerations on code smell detection tools
bull Automatic Reafactoring Jdeodorant
bull Link to the Code Jdeodorant PMD Stench Blossom JDeodorant
bull Other languages (Java) InFusion(C C++) iPlasma (C++)
bull System size computation
bull Forward engineering(development) Stench Blossom
bull Computation of the number of the smells Stench Blossom does not provide numerical values but only a visual threshold the size of a petal is directly proportional to the entity of the code smells The only possible procedure to find code smells is to manually browse the source code looking for a petal whose size is big enough to make us suppose that there is a code smell
25-03-2011 An experience report on using code smells
detection tools
Detecting smells and Metrics computation
bull How to fix thresholds of the metrics bull Define for each metric a filter that captures best the symptom that the metric is
intended to quantify ndash (1) pick-up a comparator and ndash (2) to set an adequate threshold in conformity with its semantics
bull Setting thresholds can be an effective approach for detecting domain-specific code smells The healthiness of a module in a domain may depend on the semantic information it has such as the functionality or the logic that the module implements For example
bull Brain Method smell is a method that contains too many conditional branches Although there are design solutions that can reduce the use of conditional branches they may not satisfy other design constraints In some cases using conditional branches can be the best choice among the design alternatives
bull Intensive coupling but the ldquothe coupling degree of a methodrdquo can be considered acceptable for the system in a specific domain In other words we can think that such degree of coupling would not cause maintenance problems
25-03-2011 An experience report on using code smells
detection tools
Experiment set up
110 1101 1102 1103 1111
Packages 27 27 27 28 33
Classes 393 395 396 402 549
Methods 1913 1921 1924 1937 2724
25-03-2011 An experience report on using code smells
detection tools
GanttProject System
No standard benchmark for toolrsquos comparison is available
the authors of DECOR provided the precision and recall of a
detection technique on an open-source system (multi application
platform for planning and project management) and on a
representative set of six smells
Manual validation could be subjective
Experiment results- God Class
bull The Code smell Large Class detected by DECOR is equivalent to the God Class smell recognized by JDeodorant inFusion and iPlasma In fact both specifications define classes that are trying to do too much These classes also have low cohesion
1 They heavily access data of other simpler classes either directly or using accessor methods
2 They are large and complex
3 They have a lot of non-communicative behavior ie there is a low cohesion between the methods belonging to that class
25-03-2011 An experience report on using code smells
detection tools
God Class detection
1 Class uses directly more than a few attributes of other classes Since ATFD (Access to Foreign Data) measures how many foreign attributes are
used by the class it is clear that the higher the ATFD value for a class the higher is the probability that a class is (or is about to become) a God Class (the extent to which a class uses attributes of other classes)
ATFD gt a maximun number of tolerable foreign attributes to be used (FEW where FEW is considered as [2-5])
2 Functional complexity of the class is very high This is expressed using the WMC (Weighted Method Count) metric sum of the
statical complexity of all methods in a class (consider McCabersquos cyclomatic complexity metric as a complexity measure GREATER THAN VERY HIGH
3 Class cohesion is low As a God Class performs several distinct functionalities involving disjunct sets of attributes this has a negative impact on the classrsquos cohesion
Tight Class Cohesion (TCC) is the relative number of methods directly connected via accesses of attributes LESS than13 ([033]) less than one-third of the method pairs have in common the usage of the same attribute
25-03-2011 An experience report on using code smells
detection tools
Experiment results
bull As an example the following expression evaluates if the ldquoGod classrdquo smell is present
(WMCge 47) and (ATFD gt 5) and (TCC lt1 3)
bull where WMC weighted methods per class ATFD number of accesses to foreign class data and TCC tight class cohesion
bull For Jdeodorant the God Class is detected considering the number of line of code
25-03-2011 An experience report on using code smells
detection tools
Metrics theresholds examples -iPlasma
Metric LOW AVE HIGH VERY HIGH
LOCClass 28 70 130 195
WMC 5 14 31 47
LOCMethod 7 10 13 19
NOMClass 4 7 10 15
25-03-2011 An experience report on using code smells
detection tools
Experiment results
25-03-2011 An experience report on using code smells
detection tools
bull God Class Decor-Benchmark 9 God class
Table 9 God Class comparisons
110 1101 1102 1103 1111
JDeodorant 7 (178) 6 (151) 8 (202) 5 (124) 22 (403)
InFusion 11 (279)
11 (278)
11 (277)
11 (273)
13 (238)
iPlasma 10 (254)
10 (253)
10 (252)
10 (248)
13 (238)
Experiment results-Long Parameter List
bull PMD 65 LPL with 4 parameter (DECOR 54 LPL)
25-03-2011 An experience report on using code smells
detection tools
0
10
20
30
40
50
60
70
80
90
1100 1101 1102 1103 1111
Long Parameter list Comparison
PMD - TH 4 parameters
PMD - TH 5 parameters
Experiment results-Large Class
bull PMD ndash Line of code 415 (DECOR-9 Large Class)
25-03-2011 An experience report on using code smells
detection tools
0
2
4
6
8
10
12
14
16
1100 1101 1102 1103 1111
sm
ells
Large class
Threshold 1000
Threshold 800
Threshold 600
Threshold 500
Threshold 450
Threshold 415
Threshold 400
Experiment results-Code smell evolution
-
25-03-2011 An experience report on using code smells
detection tools
Lesson learned
bull A comparison of the tools is a complex task
ndash Computing the size of the system detection techniques the metrics theresholds refactoring link to the code tool interface
bull We aim to propose a new taxonomy of smells based on refinements of smells definition clear definition of the detection techniques (necessary and sufficient conditions)
bull We gained useful information to be exploited in a tool for code smell detection
25-03-2011 An experience report on using code smells
detection tools
MARPLE
25-03-2011 An experience report on using code smells
detection tools
Marple-Code smells Detector
Currently we are able to detect the following smells
1) Feature Envy (Jdeodorant iPlasma inFusion Marple)
2) Indecent Exposure (Marple)
3) Long Parameter List (Checkstyle PMD iPlasma Marple)
4) Refused Bequest (iPlasma Marple)
5) Data Class (iPlasma inFusion Marple)
6) Lazy Class (Marple)
Future smells to detect
Comments Duplicate Code
We are interested to provide the same validation for precisionrecall on GanttProject system 25-03-2011
An experience report on using code smells detection tools
Future works
bull Extend the manual validation for other smells to improve comparison
bull Extend the experimentation with other tools as CodeVizard Checkstyleand on different system as Ant
bull Improve the Marple Code Smell Detector tool through the lessons learned in particular
bull provide a clear detection technique and clear metrics theresholds
bull provide a metrics-based approach that incorporates tailored domain-specific detection rules
bull Analyze the impact of refactoring to remove code smells on some well known object-oriented quality metrics [Arcelli Spinelli WRT 2011 ICSE Workshop]
25-03-2011 An experience report on using code smells
detection tools
Future works-Impact of Refactoring
bull Our approach is based on the following steps 1 computing the metrics on a software system
2 detecting the code smell
3 automated refactoring for one smell
4 reapplying step 1
5 analysing the incrementdecrement for each metric value
6 reapplying step 3-5 for each smell
7 identifying the smells whose refactoring better improves the quality of the analysed system
bull We have considered metrics proposed in the literature to measure cohesion coupling and complexity of a system
bull We considered Feature Envy Long Method Shotgun Surgery Large Class
25-03-2011 An experience report on using code smells
detection tools
References
bull [1] F Arcelli M Zanoni ACaracciolo A benchmark platform for design patterns detection Procceedings of the PATTERNS 2010 Conference Lisboa Portugal November 2010
bull [2] F Arcelli M Zanoni A Tool for Design Pattern Detection and Software Architecture Reconstruction Information Sciences Elsevier doi101016jins2010
bull [3] CS-CheckStyle httpcheckstylesourceforgenetindexhtml
bull [4] Martin Fowler Refactoring Improving the Design of Existing Code Addison-Wesley Inc Boston MA USA 1999
bull [5] Hamza H Counsell S Hall T and Loizou G Code smell eradication and associated refactoring 2nd European Computing Conference 2008
bull [6] YGil I Maman Micro Patterns in Java Code Proc of the 20th annual ACM SIGPLAN conference OOPSLA 2005 October 2005
bull [7] M Lanza and R Marinescu Object-Oriented Metrics in Practice Springer-Verlag 2006
bull [8] InCode httpwwwintooituscominCodehtml
bull [9] InFusion httpwwwintooituscominFusionhtml
bull [10] iPlasma httplooseuptroiplasmaindexhtml
bull [11] Mika V Maumlntylauml Jari Vanhanen and Casper Lassenius Bad smells ndash humans as code critics Proc IEEE International Conference on Software Maintenance 0399ndash408 2004
bull [12] T Mens T Tourweacute A Survey of Software Refactoring IEEE Transactions on Software Engineering vol 30 no 2 2004
25-03-2011 An experience report on using code smells
detection tools
References
bull [13] Naouel MohaYann-Gael Gueheneuc Laurence Duchien Anne-Francoise Le Meur Decor a method for the specificatio and detection of code and design smells TSE IEEE CS Press 2010
bull [14] Naouel Moha Yann-Gael Guacuteehacuteeneuc Anne-Francoise Le MeurLaurence Duchien and Alban Tiberghien From a domain analysis to the specification and detection of code and design smells Formal Aspects of Computng 2009
bull [15] Emerson Murphy-Hill Chris Parnin and Andrew P Blac How we refactor and how we know it In ICSE rsquo09 Proceedings of the 31st International Conference on Software Engineering 2009
bull [16] Emerson Murphy-Hill and Andrew P Black An interactive ambient visualization for code smells Proceedings of SOFTVIS 10 USA October 2010
bull [17] C Marinescu R Marinescu P Mihancea D Ratiu and R Wettel iplasma An integrated platform for quality assessment of object-oriented design In Proceedings of 21st International Conference on Software Maintenance (ICSM 2005) Tools Section 2005
bull [18] Steffen Olbrich Daniela Cruzes Victor Basili Nico Zazworka CodeVizardA tool to aid the analysis of software evolution Proceedings ICSE 2010 South Africa
bull [19] PMD httppmdsourceforgenet
bull [20] httpesserediscounimibitreverseCodeSmells html
bull [21] Nikolaos Tsantalis Theodoros Chaikalis and Alexander Chatzigeorgiou JDeodorant Identification and removal of type-checking bad smells In Proceedings of CSMR 2008 pp 329ndash331
bull
25-03-2011 An experience report on using code smells
detection tools
Code smells and Refactoring
ndash Not necessarily all the code smells have to be removed
ndash It is better to remove them as early as possible Tool support is important since many code smells can go unnoticed while programmers are working
ndash Code smells are not formally defined hence their detection can provide uncertain and unsafe results (tailoring of the definitions)
ndash The detection techniques used by the tools are usually based on the computation of a particular set of combined metrics or standard object-oriented metrics or metrics defined ad hoc for the smell detection purpose (define the threshold values for these metrics)
ndash The aim with detection strategies is to make design rules (and their violations) quantifiable and thus to be able to detect design problems in an object-oriented software system ie to find those design fragments that are affected by a particular design problem
25-03-2011 An experience report on using code smells
detection tools
Code smell detection tools
bull JDeodorant Feature Envy God Class Long Method Type Checking bull PMD Long Method Large Class Long Parameter List Duplicate Code
Dead Code bull Stench Blossom Data Clumps Long Method Large Class Feature Envy
Message Chain (8 smells detecting by reading the code) bull iPlasma Brain Class Brain Method Data Class Feature Envy God Class
Extensive Coupling Feature Envy God Class bull inFusion Brain method Data Class Feature Envy God Class Refused
Parent Bequest Significant Duplication
bull Decor Lazy Class Long Method Large Class Long Parameter List Refused Bequest Speculative Generality Message Chains Data Class Tradition Breaker (29 code and design smells)
bull CheckStyle Long Method Long parameter list Large Class DuplCode bull Codecity Feature Envy Brain Class God Class Data Class Brain Method
Intensive Coupling Dispersed Coupling Shotgun Surgery
bull CodeVizard God Class Shotgun Surgery
25-03-2011
An experience report on using code smells detection tools
Considerations on code smell detection tools
bull Automatic Reafactoring Jdeodorant
bull Link to the Code Jdeodorant PMD Stench Blossom JDeodorant
bull Other languages (Java) InFusion(C C++) iPlasma (C++)
bull System size computation
bull Forward engineering(development) Stench Blossom
bull Computation of the number of the smells Stench Blossom does not provide numerical values but only a visual threshold the size of a petal is directly proportional to the entity of the code smells The only possible procedure to find code smells is to manually browse the source code looking for a petal whose size is big enough to make us suppose that there is a code smell
25-03-2011 An experience report on using code smells
detection tools
Detecting smells and Metrics computation
bull How to fix thresholds of the metrics bull Define for each metric a filter that captures best the symptom that the metric is
intended to quantify ndash (1) pick-up a comparator and ndash (2) to set an adequate threshold in conformity with its semantics
bull Setting thresholds can be an effective approach for detecting domain-specific code smells The healthiness of a module in a domain may depend on the semantic information it has such as the functionality or the logic that the module implements For example
bull Brain Method smell is a method that contains too many conditional branches Although there are design solutions that can reduce the use of conditional branches they may not satisfy other design constraints In some cases using conditional branches can be the best choice among the design alternatives
bull Intensive coupling but the ldquothe coupling degree of a methodrdquo can be considered acceptable for the system in a specific domain In other words we can think that such degree of coupling would not cause maintenance problems
25-03-2011 An experience report on using code smells
detection tools
Experiment set up
110 1101 1102 1103 1111
Packages 27 27 27 28 33
Classes 393 395 396 402 549
Methods 1913 1921 1924 1937 2724
25-03-2011 An experience report on using code smells
detection tools
GanttProject System
No standard benchmark for toolrsquos comparison is available
the authors of DECOR provided the precision and recall of a
detection technique on an open-source system (multi application
platform for planning and project management) and on a
representative set of six smells
Manual validation could be subjective
Experiment results- God Class
bull The Code smell Large Class detected by DECOR is equivalent to the God Class smell recognized by JDeodorant inFusion and iPlasma In fact both specifications define classes that are trying to do too much These classes also have low cohesion
1 They heavily access data of other simpler classes either directly or using accessor methods
2 They are large and complex
3 They have a lot of non-communicative behavior ie there is a low cohesion between the methods belonging to that class
25-03-2011 An experience report on using code smells
detection tools
God Class detection
1 Class uses directly more than a few attributes of other classes Since ATFD (Access to Foreign Data) measures how many foreign attributes are
used by the class it is clear that the higher the ATFD value for a class the higher is the probability that a class is (or is about to become) a God Class (the extent to which a class uses attributes of other classes)
ATFD gt a maximun number of tolerable foreign attributes to be used (FEW where FEW is considered as [2-5])
2 Functional complexity of the class is very high This is expressed using the WMC (Weighted Method Count) metric sum of the
statical complexity of all methods in a class (consider McCabersquos cyclomatic complexity metric as a complexity measure GREATER THAN VERY HIGH
3 Class cohesion is low As a God Class performs several distinct functionalities involving disjunct sets of attributes this has a negative impact on the classrsquos cohesion
Tight Class Cohesion (TCC) is the relative number of methods directly connected via accesses of attributes LESS than13 ([033]) less than one-third of the method pairs have in common the usage of the same attribute
25-03-2011 An experience report on using code smells
detection tools
Experiment results
bull As an example the following expression evaluates if the ldquoGod classrdquo smell is present
(WMCge 47) and (ATFD gt 5) and (TCC lt1 3)
bull where WMC weighted methods per class ATFD number of accesses to foreign class data and TCC tight class cohesion
bull For Jdeodorant the God Class is detected considering the number of line of code
25-03-2011 An experience report on using code smells
detection tools
Metrics theresholds examples -iPlasma
Metric LOW AVE HIGH VERY HIGH
LOCClass 28 70 130 195
WMC 5 14 31 47
LOCMethod 7 10 13 19
NOMClass 4 7 10 15
25-03-2011 An experience report on using code smells
detection tools
Experiment results
25-03-2011 An experience report on using code smells
detection tools
bull God Class Decor-Benchmark 9 God class
Table 9 God Class comparisons
110 1101 1102 1103 1111
JDeodorant 7 (178) 6 (151) 8 (202) 5 (124) 22 (403)
InFusion 11 (279)
11 (278)
11 (277)
11 (273)
13 (238)
iPlasma 10 (254)
10 (253)
10 (252)
10 (248)
13 (238)
Experiment results-Long Parameter List
bull PMD 65 LPL with 4 parameter (DECOR 54 LPL)
25-03-2011 An experience report on using code smells
detection tools
0
10
20
30
40
50
60
70
80
90
1100 1101 1102 1103 1111
Long Parameter list Comparison
PMD - TH 4 parameters
PMD - TH 5 parameters
Experiment results-Large Class
bull PMD ndash Line of code 415 (DECOR-9 Large Class)
25-03-2011 An experience report on using code smells
detection tools
0
2
4
6
8
10
12
14
16
1100 1101 1102 1103 1111
sm
ells
Large class
Threshold 1000
Threshold 800
Threshold 600
Threshold 500
Threshold 450
Threshold 415
Threshold 400
Experiment results-Code smell evolution
-
25-03-2011 An experience report on using code smells
detection tools
Lesson learned
bull A comparison of the tools is a complex task
ndash Computing the size of the system detection techniques the metrics theresholds refactoring link to the code tool interface
bull We aim to propose a new taxonomy of smells based on refinements of smells definition clear definition of the detection techniques (necessary and sufficient conditions)
bull We gained useful information to be exploited in a tool for code smell detection
25-03-2011 An experience report on using code smells
detection tools
MARPLE
25-03-2011 An experience report on using code smells
detection tools
Marple-Code smells Detector
Currently we are able to detect the following smells
1) Feature Envy (Jdeodorant iPlasma inFusion Marple)
2) Indecent Exposure (Marple)
3) Long Parameter List (Checkstyle PMD iPlasma Marple)
4) Refused Bequest (iPlasma Marple)
5) Data Class (iPlasma inFusion Marple)
6) Lazy Class (Marple)
Future smells to detect
Comments Duplicate Code
We are interested to provide the same validation for precisionrecall on GanttProject system 25-03-2011
An experience report on using code smells detection tools
Future works
bull Extend the manual validation for other smells to improve comparison
bull Extend the experimentation with other tools as CodeVizard Checkstyleand on different system as Ant
bull Improve the Marple Code Smell Detector tool through the lessons learned in particular
bull provide a clear detection technique and clear metrics theresholds
bull provide a metrics-based approach that incorporates tailored domain-specific detection rules
bull Analyze the impact of refactoring to remove code smells on some well known object-oriented quality metrics [Arcelli Spinelli WRT 2011 ICSE Workshop]
25-03-2011 An experience report on using code smells
detection tools
Future works-Impact of Refactoring
bull Our approach is based on the following steps 1 computing the metrics on a software system
2 detecting the code smell
3 automated refactoring for one smell
4 reapplying step 1
5 analysing the incrementdecrement for each metric value
6 reapplying step 3-5 for each smell
7 identifying the smells whose refactoring better improves the quality of the analysed system
bull We have considered metrics proposed in the literature to measure cohesion coupling and complexity of a system
bull We considered Feature Envy Long Method Shotgun Surgery Large Class
25-03-2011 An experience report on using code smells
detection tools
References
bull [1] F Arcelli M Zanoni ACaracciolo A benchmark platform for design patterns detection Procceedings of the PATTERNS 2010 Conference Lisboa Portugal November 2010
bull [2] F Arcelli M Zanoni A Tool for Design Pattern Detection and Software Architecture Reconstruction Information Sciences Elsevier doi101016jins2010
bull [3] CS-CheckStyle httpcheckstylesourceforgenetindexhtml
bull [4] Martin Fowler Refactoring Improving the Design of Existing Code Addison-Wesley Inc Boston MA USA 1999
bull [5] Hamza H Counsell S Hall T and Loizou G Code smell eradication and associated refactoring 2nd European Computing Conference 2008
bull [6] YGil I Maman Micro Patterns in Java Code Proc of the 20th annual ACM SIGPLAN conference OOPSLA 2005 October 2005
bull [7] M Lanza and R Marinescu Object-Oriented Metrics in Practice Springer-Verlag 2006
bull [8] InCode httpwwwintooituscominCodehtml
bull [9] InFusion httpwwwintooituscominFusionhtml
bull [10] iPlasma httplooseuptroiplasmaindexhtml
bull [11] Mika V Maumlntylauml Jari Vanhanen and Casper Lassenius Bad smells ndash humans as code critics Proc IEEE International Conference on Software Maintenance 0399ndash408 2004
bull [12] T Mens T Tourweacute A Survey of Software Refactoring IEEE Transactions on Software Engineering vol 30 no 2 2004
25-03-2011 An experience report on using code smells
detection tools
References
bull [13] Naouel MohaYann-Gael Gueheneuc Laurence Duchien Anne-Francoise Le Meur Decor a method for the specificatio and detection of code and design smells TSE IEEE CS Press 2010
bull [14] Naouel Moha Yann-Gael Guacuteehacuteeneuc Anne-Francoise Le MeurLaurence Duchien and Alban Tiberghien From a domain analysis to the specification and detection of code and design smells Formal Aspects of Computng 2009
bull [15] Emerson Murphy-Hill Chris Parnin and Andrew P Blac How we refactor and how we know it In ICSE rsquo09 Proceedings of the 31st International Conference on Software Engineering 2009
bull [16] Emerson Murphy-Hill and Andrew P Black An interactive ambient visualization for code smells Proceedings of SOFTVIS 10 USA October 2010
bull [17] C Marinescu R Marinescu P Mihancea D Ratiu and R Wettel iplasma An integrated platform for quality assessment of object-oriented design In Proceedings of 21st International Conference on Software Maintenance (ICSM 2005) Tools Section 2005
bull [18] Steffen Olbrich Daniela Cruzes Victor Basili Nico Zazworka CodeVizardA tool to aid the analysis of software evolution Proceedings ICSE 2010 South Africa
bull [19] PMD httppmdsourceforgenet
bull [20] httpesserediscounimibitreverseCodeSmells html
bull [21] Nikolaos Tsantalis Theodoros Chaikalis and Alexander Chatzigeorgiou JDeodorant Identification and removal of type-checking bad smells In Proceedings of CSMR 2008 pp 329ndash331
bull
25-03-2011 An experience report on using code smells
detection tools
Code smell detection tools
bull JDeodorant Feature Envy God Class Long Method Type Checking bull PMD Long Method Large Class Long Parameter List Duplicate Code
Dead Code bull Stench Blossom Data Clumps Long Method Large Class Feature Envy
Message Chain (8 smells detecting by reading the code) bull iPlasma Brain Class Brain Method Data Class Feature Envy God Class
Extensive Coupling Feature Envy God Class bull inFusion Brain method Data Class Feature Envy God Class Refused
Parent Bequest Significant Duplication
bull Decor Lazy Class Long Method Large Class Long Parameter List Refused Bequest Speculative Generality Message Chains Data Class Tradition Breaker (29 code and design smells)
bull CheckStyle Long Method Long parameter list Large Class DuplCode bull Codecity Feature Envy Brain Class God Class Data Class Brain Method
Intensive Coupling Dispersed Coupling Shotgun Surgery
bull CodeVizard God Class Shotgun Surgery
25-03-2011
An experience report on using code smells detection tools
Considerations on code smell detection tools
bull Automatic Reafactoring Jdeodorant
bull Link to the Code Jdeodorant PMD Stench Blossom JDeodorant
bull Other languages (Java) InFusion(C C++) iPlasma (C++)
bull System size computation
bull Forward engineering(development) Stench Blossom
bull Computation of the number of the smells Stench Blossom does not provide numerical values but only a visual threshold the size of a petal is directly proportional to the entity of the code smells The only possible procedure to find code smells is to manually browse the source code looking for a petal whose size is big enough to make us suppose that there is a code smell
25-03-2011 An experience report on using code smells
detection tools
Detecting smells and Metrics computation
bull How to fix thresholds of the metrics bull Define for each metric a filter that captures best the symptom that the metric is
intended to quantify ndash (1) pick-up a comparator and ndash (2) to set an adequate threshold in conformity with its semantics
bull Setting thresholds can be an effective approach for detecting domain-specific code smells The healthiness of a module in a domain may depend on the semantic information it has such as the functionality or the logic that the module implements For example
bull Brain Method smell is a method that contains too many conditional branches Although there are design solutions that can reduce the use of conditional branches they may not satisfy other design constraints In some cases using conditional branches can be the best choice among the design alternatives
bull Intensive coupling but the ldquothe coupling degree of a methodrdquo can be considered acceptable for the system in a specific domain In other words we can think that such degree of coupling would not cause maintenance problems
25-03-2011 An experience report on using code smells
detection tools
Experiment set up
110 1101 1102 1103 1111
Packages 27 27 27 28 33
Classes 393 395 396 402 549
Methods 1913 1921 1924 1937 2724
25-03-2011 An experience report on using code smells
detection tools
GanttProject System
No standard benchmark for toolrsquos comparison is available
the authors of DECOR provided the precision and recall of a
detection technique on an open-source system (multi application
platform for planning and project management) and on a
representative set of six smells
Manual validation could be subjective
Experiment results- God Class
bull The Code smell Large Class detected by DECOR is equivalent to the God Class smell recognized by JDeodorant inFusion and iPlasma In fact both specifications define classes that are trying to do too much These classes also have low cohesion
1 They heavily access data of other simpler classes either directly or using accessor methods
2 They are large and complex
3 They have a lot of non-communicative behavior ie there is a low cohesion between the methods belonging to that class
25-03-2011 An experience report on using code smells
detection tools
God Class detection
1 Class uses directly more than a few attributes of other classes Since ATFD (Access to Foreign Data) measures how many foreign attributes are
used by the class it is clear that the higher the ATFD value for a class the higher is the probability that a class is (or is about to become) a God Class (the extent to which a class uses attributes of other classes)
ATFD gt a maximun number of tolerable foreign attributes to be used (FEW where FEW is considered as [2-5])
2 Functional complexity of the class is very high This is expressed using the WMC (Weighted Method Count) metric sum of the
statical complexity of all methods in a class (consider McCabersquos cyclomatic complexity metric as a complexity measure GREATER THAN VERY HIGH
3 Class cohesion is low As a God Class performs several distinct functionalities involving disjunct sets of attributes this has a negative impact on the classrsquos cohesion
Tight Class Cohesion (TCC) is the relative number of methods directly connected via accesses of attributes LESS than13 ([033]) less than one-third of the method pairs have in common the usage of the same attribute
25-03-2011 An experience report on using code smells
detection tools
Experiment results
bull As an example the following expression evaluates if the ldquoGod classrdquo smell is present
(WMCge 47) and (ATFD gt 5) and (TCC lt1 3)
bull where WMC weighted methods per class ATFD number of accesses to foreign class data and TCC tight class cohesion
bull For Jdeodorant the God Class is detected considering the number of line of code
25-03-2011 An experience report on using code smells
detection tools
Metrics theresholds examples -iPlasma
Metric LOW AVE HIGH VERY HIGH
LOCClass 28 70 130 195
WMC 5 14 31 47
LOCMethod 7 10 13 19
NOMClass 4 7 10 15
25-03-2011 An experience report on using code smells
detection tools
Experiment results
25-03-2011 An experience report on using code smells
detection tools
bull God Class Decor-Benchmark 9 God class
Table 9 God Class comparisons
110 1101 1102 1103 1111
JDeodorant 7 (178) 6 (151) 8 (202) 5 (124) 22 (403)
InFusion 11 (279)
11 (278)
11 (277)
11 (273)
13 (238)
iPlasma 10 (254)
10 (253)
10 (252)
10 (248)
13 (238)
Experiment results-Long Parameter List
bull PMD 65 LPL with 4 parameter (DECOR 54 LPL)
25-03-2011 An experience report on using code smells
detection tools
0
10
20
30
40
50
60
70
80
90
1100 1101 1102 1103 1111
Long Parameter list Comparison
PMD - TH 4 parameters
PMD - TH 5 parameters
Experiment results-Large Class
bull PMD ndash Line of code 415 (DECOR-9 Large Class)
25-03-2011 An experience report on using code smells
detection tools
0
2
4
6
8
10
12
14
16
1100 1101 1102 1103 1111
sm
ells
Large class
Threshold 1000
Threshold 800
Threshold 600
Threshold 500
Threshold 450
Threshold 415
Threshold 400
Experiment results-Code smell evolution
-
25-03-2011 An experience report on using code smells
detection tools
Lesson learned
bull A comparison of the tools is a complex task
ndash Computing the size of the system detection techniques the metrics theresholds refactoring link to the code tool interface
bull We aim to propose a new taxonomy of smells based on refinements of smells definition clear definition of the detection techniques (necessary and sufficient conditions)
bull We gained useful information to be exploited in a tool for code smell detection
25-03-2011 An experience report on using code smells
detection tools
MARPLE
25-03-2011 An experience report on using code smells
detection tools
Marple-Code smells Detector
Currently we are able to detect the following smells
1) Feature Envy (Jdeodorant iPlasma inFusion Marple)
2) Indecent Exposure (Marple)
3) Long Parameter List (Checkstyle PMD iPlasma Marple)
4) Refused Bequest (iPlasma Marple)
5) Data Class (iPlasma inFusion Marple)
6) Lazy Class (Marple)
Future smells to detect
Comments Duplicate Code
We are interested to provide the same validation for precisionrecall on GanttProject system 25-03-2011
An experience report on using code smells detection tools
Future works
bull Extend the manual validation for other smells to improve comparison
bull Extend the experimentation with other tools as CodeVizard Checkstyleand on different system as Ant
bull Improve the Marple Code Smell Detector tool through the lessons learned in particular
bull provide a clear detection technique and clear metrics theresholds
bull provide a metrics-based approach that incorporates tailored domain-specific detection rules
bull Analyze the impact of refactoring to remove code smells on some well known object-oriented quality metrics [Arcelli Spinelli WRT 2011 ICSE Workshop]
25-03-2011 An experience report on using code smells
detection tools
Future works-Impact of Refactoring
bull Our approach is based on the following steps 1 computing the metrics on a software system
2 detecting the code smell
3 automated refactoring for one smell
4 reapplying step 1
5 analysing the incrementdecrement for each metric value
6 reapplying step 3-5 for each smell
7 identifying the smells whose refactoring better improves the quality of the analysed system
bull We have considered metrics proposed in the literature to measure cohesion coupling and complexity of a system
bull We considered Feature Envy Long Method Shotgun Surgery Large Class
25-03-2011 An experience report on using code smells
detection tools
References
bull [1] F Arcelli M Zanoni ACaracciolo A benchmark platform for design patterns detection Procceedings of the PATTERNS 2010 Conference Lisboa Portugal November 2010
bull [2] F Arcelli M Zanoni A Tool for Design Pattern Detection and Software Architecture Reconstruction Information Sciences Elsevier doi101016jins2010
bull [3] CS-CheckStyle httpcheckstylesourceforgenetindexhtml
bull [4] Martin Fowler Refactoring Improving the Design of Existing Code Addison-Wesley Inc Boston MA USA 1999
bull [5] Hamza H Counsell S Hall T and Loizou G Code smell eradication and associated refactoring 2nd European Computing Conference 2008
bull [6] YGil I Maman Micro Patterns in Java Code Proc of the 20th annual ACM SIGPLAN conference OOPSLA 2005 October 2005
bull [7] M Lanza and R Marinescu Object-Oriented Metrics in Practice Springer-Verlag 2006
bull [8] InCode httpwwwintooituscominCodehtml
bull [9] InFusion httpwwwintooituscominFusionhtml
bull [10] iPlasma httplooseuptroiplasmaindexhtml
bull [11] Mika V Maumlntylauml Jari Vanhanen and Casper Lassenius Bad smells ndash humans as code critics Proc IEEE International Conference on Software Maintenance 0399ndash408 2004
bull [12] T Mens T Tourweacute A Survey of Software Refactoring IEEE Transactions on Software Engineering vol 30 no 2 2004
25-03-2011 An experience report on using code smells
detection tools
References
bull [13] Naouel MohaYann-Gael Gueheneuc Laurence Duchien Anne-Francoise Le Meur Decor a method for the specificatio and detection of code and design smells TSE IEEE CS Press 2010
bull [14] Naouel Moha Yann-Gael Guacuteehacuteeneuc Anne-Francoise Le MeurLaurence Duchien and Alban Tiberghien From a domain analysis to the specification and detection of code and design smells Formal Aspects of Computng 2009
bull [15] Emerson Murphy-Hill Chris Parnin and Andrew P Blac How we refactor and how we know it In ICSE rsquo09 Proceedings of the 31st International Conference on Software Engineering 2009
bull [16] Emerson Murphy-Hill and Andrew P Black An interactive ambient visualization for code smells Proceedings of SOFTVIS 10 USA October 2010
bull [17] C Marinescu R Marinescu P Mihancea D Ratiu and R Wettel iplasma An integrated platform for quality assessment of object-oriented design In Proceedings of 21st International Conference on Software Maintenance (ICSM 2005) Tools Section 2005
bull [18] Steffen Olbrich Daniela Cruzes Victor Basili Nico Zazworka CodeVizardA tool to aid the analysis of software evolution Proceedings ICSE 2010 South Africa
bull [19] PMD httppmdsourceforgenet
bull [20] httpesserediscounimibitreverseCodeSmells html
bull [21] Nikolaos Tsantalis Theodoros Chaikalis and Alexander Chatzigeorgiou JDeodorant Identification and removal of type-checking bad smells In Proceedings of CSMR 2008 pp 329ndash331
bull
25-03-2011 An experience report on using code smells
detection tools
Considerations on code smell detection tools
bull Automatic Reafactoring Jdeodorant
bull Link to the Code Jdeodorant PMD Stench Blossom JDeodorant
bull Other languages (Java) InFusion(C C++) iPlasma (C++)
bull System size computation
bull Forward engineering(development) Stench Blossom
bull Computation of the number of the smells Stench Blossom does not provide numerical values but only a visual threshold the size of a petal is directly proportional to the entity of the code smells The only possible procedure to find code smells is to manually browse the source code looking for a petal whose size is big enough to make us suppose that there is a code smell
25-03-2011 An experience report on using code smells
detection tools
Detecting smells and Metrics computation
bull How to fix thresholds of the metrics bull Define for each metric a filter that captures best the symptom that the metric is
intended to quantify ndash (1) pick-up a comparator and ndash (2) to set an adequate threshold in conformity with its semantics
bull Setting thresholds can be an effective approach for detecting domain-specific code smells The healthiness of a module in a domain may depend on the semantic information it has such as the functionality or the logic that the module implements For example
bull Brain Method smell is a method that contains too many conditional branches Although there are design solutions that can reduce the use of conditional branches they may not satisfy other design constraints In some cases using conditional branches can be the best choice among the design alternatives
bull Intensive coupling but the ldquothe coupling degree of a methodrdquo can be considered acceptable for the system in a specific domain In other words we can think that such degree of coupling would not cause maintenance problems
25-03-2011 An experience report on using code smells
detection tools
Experiment set up
110 1101 1102 1103 1111
Packages 27 27 27 28 33
Classes 393 395 396 402 549
Methods 1913 1921 1924 1937 2724
25-03-2011 An experience report on using code smells
detection tools
GanttProject System
No standard benchmark for toolrsquos comparison is available
the authors of DECOR provided the precision and recall of a
detection technique on an open-source system (multi application
platform for planning and project management) and on a
representative set of six smells
Manual validation could be subjective
Experiment results- God Class
bull The Code smell Large Class detected by DECOR is equivalent to the God Class smell recognized by JDeodorant inFusion and iPlasma In fact both specifications define classes that are trying to do too much These classes also have low cohesion
1 They heavily access data of other simpler classes either directly or using accessor methods
2 They are large and complex
3 They have a lot of non-communicative behavior ie there is a low cohesion between the methods belonging to that class
25-03-2011 An experience report on using code smells
detection tools
God Class detection
1 Class uses directly more than a few attributes of other classes Since ATFD (Access to Foreign Data) measures how many foreign attributes are
used by the class it is clear that the higher the ATFD value for a class the higher is the probability that a class is (or is about to become) a God Class (the extent to which a class uses attributes of other classes)
ATFD gt a maximun number of tolerable foreign attributes to be used (FEW where FEW is considered as [2-5])
2 Functional complexity of the class is very high This is expressed using the WMC (Weighted Method Count) metric sum of the
statical complexity of all methods in a class (consider McCabersquos cyclomatic complexity metric as a complexity measure GREATER THAN VERY HIGH
3 Class cohesion is low As a God Class performs several distinct functionalities involving disjunct sets of attributes this has a negative impact on the classrsquos cohesion
Tight Class Cohesion (TCC) is the relative number of methods directly connected via accesses of attributes LESS than13 ([033]) less than one-third of the method pairs have in common the usage of the same attribute
25-03-2011 An experience report on using code smells
detection tools
Experiment results
bull As an example the following expression evaluates if the ldquoGod classrdquo smell is present
(WMCge 47) and (ATFD gt 5) and (TCC lt1 3)
bull where WMC weighted methods per class ATFD number of accesses to foreign class data and TCC tight class cohesion
bull For Jdeodorant the God Class is detected considering the number of line of code
25-03-2011 An experience report on using code smells
detection tools
Metrics theresholds examples -iPlasma
Metric LOW AVE HIGH VERY HIGH
LOCClass 28 70 130 195
WMC 5 14 31 47
LOCMethod 7 10 13 19
NOMClass 4 7 10 15
25-03-2011 An experience report on using code smells
detection tools
Experiment results
25-03-2011 An experience report on using code smells
detection tools
bull God Class Decor-Benchmark 9 God class
Table 9 God Class comparisons
110 1101 1102 1103 1111
JDeodorant 7 (178) 6 (151) 8 (202) 5 (124) 22 (403)
InFusion 11 (279)
11 (278)
11 (277)
11 (273)
13 (238)
iPlasma 10 (254)
10 (253)
10 (252)
10 (248)
13 (238)
Experiment results-Long Parameter List
bull PMD 65 LPL with 4 parameter (DECOR 54 LPL)
25-03-2011 An experience report on using code smells
detection tools
0
10
20
30
40
50
60
70
80
90
1100 1101 1102 1103 1111
Long Parameter list Comparison
PMD - TH 4 parameters
PMD - TH 5 parameters
Experiment results-Large Class
bull PMD ndash Line of code 415 (DECOR-9 Large Class)
25-03-2011 An experience report on using code smells
detection tools
0
2
4
6
8
10
12
14
16
1100 1101 1102 1103 1111
sm
ells
Large class
Threshold 1000
Threshold 800
Threshold 600
Threshold 500
Threshold 450
Threshold 415
Threshold 400
Experiment results-Code smell evolution
-
25-03-2011 An experience report on using code smells
detection tools
Lesson learned
bull A comparison of the tools is a complex task
ndash Computing the size of the system detection techniques the metrics theresholds refactoring link to the code tool interface
bull We aim to propose a new taxonomy of smells based on refinements of smells definition clear definition of the detection techniques (necessary and sufficient conditions)
bull We gained useful information to be exploited in a tool for code smell detection
25-03-2011 An experience report on using code smells
detection tools
MARPLE
25-03-2011 An experience report on using code smells
detection tools
Marple-Code smells Detector
Currently we are able to detect the following smells
1) Feature Envy (Jdeodorant iPlasma inFusion Marple)
2) Indecent Exposure (Marple)
3) Long Parameter List (Checkstyle PMD iPlasma Marple)
4) Refused Bequest (iPlasma Marple)
5) Data Class (iPlasma inFusion Marple)
6) Lazy Class (Marple)
Future smells to detect
Comments Duplicate Code
We are interested to provide the same validation for precisionrecall on GanttProject system 25-03-2011
An experience report on using code smells detection tools
Future works
bull Extend the manual validation for other smells to improve comparison
bull Extend the experimentation with other tools as CodeVizard Checkstyleand on different system as Ant
bull Improve the Marple Code Smell Detector tool through the lessons learned in particular
bull provide a clear detection technique and clear metrics theresholds
bull provide a metrics-based approach that incorporates tailored domain-specific detection rules
bull Analyze the impact of refactoring to remove code smells on some well known object-oriented quality metrics [Arcelli Spinelli WRT 2011 ICSE Workshop]
25-03-2011 An experience report on using code smells
detection tools
Future works-Impact of Refactoring
bull Our approach is based on the following steps 1 computing the metrics on a software system
2 detecting the code smell
3 automated refactoring for one smell
4 reapplying step 1
5 analysing the incrementdecrement for each metric value
6 reapplying step 3-5 for each smell
7 identifying the smells whose refactoring better improves the quality of the analysed system
bull We have considered metrics proposed in the literature to measure cohesion coupling and complexity of a system
bull We considered Feature Envy Long Method Shotgun Surgery Large Class
25-03-2011 An experience report on using code smells
detection tools
References
bull [1] F Arcelli M Zanoni ACaracciolo A benchmark platform for design patterns detection Procceedings of the PATTERNS 2010 Conference Lisboa Portugal November 2010
bull [2] F Arcelli M Zanoni A Tool for Design Pattern Detection and Software Architecture Reconstruction Information Sciences Elsevier doi101016jins2010
bull [3] CS-CheckStyle httpcheckstylesourceforgenetindexhtml
bull [4] Martin Fowler Refactoring Improving the Design of Existing Code Addison-Wesley Inc Boston MA USA 1999
bull [5] Hamza H Counsell S Hall T and Loizou G Code smell eradication and associated refactoring 2nd European Computing Conference 2008
bull [6] YGil I Maman Micro Patterns in Java Code Proc of the 20th annual ACM SIGPLAN conference OOPSLA 2005 October 2005
bull [7] M Lanza and R Marinescu Object-Oriented Metrics in Practice Springer-Verlag 2006
bull [8] InCode httpwwwintooituscominCodehtml
bull [9] InFusion httpwwwintooituscominFusionhtml
bull [10] iPlasma httplooseuptroiplasmaindexhtml
bull [11] Mika V Maumlntylauml Jari Vanhanen and Casper Lassenius Bad smells ndash humans as code critics Proc IEEE International Conference on Software Maintenance 0399ndash408 2004
bull [12] T Mens T Tourweacute A Survey of Software Refactoring IEEE Transactions on Software Engineering vol 30 no 2 2004
25-03-2011 An experience report on using code smells
detection tools
References
bull [13] Naouel MohaYann-Gael Gueheneuc Laurence Duchien Anne-Francoise Le Meur Decor a method for the specificatio and detection of code and design smells TSE IEEE CS Press 2010
bull [14] Naouel Moha Yann-Gael Guacuteehacuteeneuc Anne-Francoise Le MeurLaurence Duchien and Alban Tiberghien From a domain analysis to the specification and detection of code and design smells Formal Aspects of Computng 2009
bull [15] Emerson Murphy-Hill Chris Parnin and Andrew P Blac How we refactor and how we know it In ICSE rsquo09 Proceedings of the 31st International Conference on Software Engineering 2009
bull [16] Emerson Murphy-Hill and Andrew P Black An interactive ambient visualization for code smells Proceedings of SOFTVIS 10 USA October 2010
bull [17] C Marinescu R Marinescu P Mihancea D Ratiu and R Wettel iplasma An integrated platform for quality assessment of object-oriented design In Proceedings of 21st International Conference on Software Maintenance (ICSM 2005) Tools Section 2005
bull [18] Steffen Olbrich Daniela Cruzes Victor Basili Nico Zazworka CodeVizardA tool to aid the analysis of software evolution Proceedings ICSE 2010 South Africa
bull [19] PMD httppmdsourceforgenet
bull [20] httpesserediscounimibitreverseCodeSmells html
bull [21] Nikolaos Tsantalis Theodoros Chaikalis and Alexander Chatzigeorgiou JDeodorant Identification and removal of type-checking bad smells In Proceedings of CSMR 2008 pp 329ndash331
bull
25-03-2011 An experience report on using code smells
detection tools
Detecting smells and Metrics computation
bull How to fix thresholds of the metrics bull Define for each metric a filter that captures best the symptom that the metric is
intended to quantify ndash (1) pick-up a comparator and ndash (2) to set an adequate threshold in conformity with its semantics
bull Setting thresholds can be an effective approach for detecting domain-specific code smells The healthiness of a module in a domain may depend on the semantic information it has such as the functionality or the logic that the module implements For example
bull Brain Method smell is a method that contains too many conditional branches Although there are design solutions that can reduce the use of conditional branches they may not satisfy other design constraints In some cases using conditional branches can be the best choice among the design alternatives
bull Intensive coupling but the ldquothe coupling degree of a methodrdquo can be considered acceptable for the system in a specific domain In other words we can think that such degree of coupling would not cause maintenance problems
25-03-2011 An experience report on using code smells
detection tools
Experiment set up
110 1101 1102 1103 1111
Packages 27 27 27 28 33
Classes 393 395 396 402 549
Methods 1913 1921 1924 1937 2724
25-03-2011 An experience report on using code smells
detection tools
GanttProject System
No standard benchmark for toolrsquos comparison is available
the authors of DECOR provided the precision and recall of a
detection technique on an open-source system (multi application
platform for planning and project management) and on a
representative set of six smells
Manual validation could be subjective
Experiment results- God Class
bull The Code smell Large Class detected by DECOR is equivalent to the God Class smell recognized by JDeodorant inFusion and iPlasma In fact both specifications define classes that are trying to do too much These classes also have low cohesion
1 They heavily access data of other simpler classes either directly or using accessor methods
2 They are large and complex
3 They have a lot of non-communicative behavior ie there is a low cohesion between the methods belonging to that class
25-03-2011 An experience report on using code smells
detection tools
God Class detection
1 Class uses directly more than a few attributes of other classes Since ATFD (Access to Foreign Data) measures how many foreign attributes are
used by the class it is clear that the higher the ATFD value for a class the higher is the probability that a class is (or is about to become) a God Class (the extent to which a class uses attributes of other classes)
ATFD gt a maximun number of tolerable foreign attributes to be used (FEW where FEW is considered as [2-5])
2 Functional complexity of the class is very high This is expressed using the WMC (Weighted Method Count) metric sum of the
statical complexity of all methods in a class (consider McCabersquos cyclomatic complexity metric as a complexity measure GREATER THAN VERY HIGH
3 Class cohesion is low As a God Class performs several distinct functionalities involving disjunct sets of attributes this has a negative impact on the classrsquos cohesion
Tight Class Cohesion (TCC) is the relative number of methods directly connected via accesses of attributes LESS than13 ([033]) less than one-third of the method pairs have in common the usage of the same attribute
25-03-2011 An experience report on using code smells
detection tools
Experiment results
bull As an example the following expression evaluates if the ldquoGod classrdquo smell is present
(WMCge 47) and (ATFD gt 5) and (TCC lt1 3)
bull where WMC weighted methods per class ATFD number of accesses to foreign class data and TCC tight class cohesion
bull For Jdeodorant the God Class is detected considering the number of line of code
25-03-2011 An experience report on using code smells
detection tools
Metrics theresholds examples -iPlasma
Metric LOW AVE HIGH VERY HIGH
LOCClass 28 70 130 195
WMC 5 14 31 47
LOCMethod 7 10 13 19
NOMClass 4 7 10 15
25-03-2011 An experience report on using code smells
detection tools
Experiment results
25-03-2011 An experience report on using code smells
detection tools
bull God Class Decor-Benchmark 9 God class
Table 9 God Class comparisons
110 1101 1102 1103 1111
JDeodorant 7 (178) 6 (151) 8 (202) 5 (124) 22 (403)
InFusion 11 (279)
11 (278)
11 (277)
11 (273)
13 (238)
iPlasma 10 (254)
10 (253)
10 (252)
10 (248)
13 (238)
Experiment results-Long Parameter List
bull PMD 65 LPL with 4 parameter (DECOR 54 LPL)
25-03-2011 An experience report on using code smells
detection tools
0
10
20
30
40
50
60
70
80
90
1100 1101 1102 1103 1111
Long Parameter list Comparison
PMD - TH 4 parameters
PMD - TH 5 parameters
Experiment results-Large Class
bull PMD ndash Line of code 415 (DECOR-9 Large Class)
25-03-2011 An experience report on using code smells
detection tools
0
2
4
6
8
10
12
14
16
1100 1101 1102 1103 1111
sm
ells
Large class
Threshold 1000
Threshold 800
Threshold 600
Threshold 500
Threshold 450
Threshold 415
Threshold 400
Experiment results-Code smell evolution
-
25-03-2011 An experience report on using code smells
detection tools
Lesson learned
bull A comparison of the tools is a complex task
ndash Computing the size of the system detection techniques the metrics theresholds refactoring link to the code tool interface
bull We aim to propose a new taxonomy of smells based on refinements of smells definition clear definition of the detection techniques (necessary and sufficient conditions)
bull We gained useful information to be exploited in a tool for code smell detection
25-03-2011 An experience report on using code smells
detection tools
MARPLE
25-03-2011 An experience report on using code smells
detection tools
Marple-Code smells Detector
Currently we are able to detect the following smells
1) Feature Envy (Jdeodorant iPlasma inFusion Marple)
2) Indecent Exposure (Marple)
3) Long Parameter List (Checkstyle PMD iPlasma Marple)
4) Refused Bequest (iPlasma Marple)
5) Data Class (iPlasma inFusion Marple)
6) Lazy Class (Marple)
Future smells to detect
Comments Duplicate Code
We are interested to provide the same validation for precisionrecall on GanttProject system 25-03-2011
An experience report on using code smells detection tools
Future works
bull Extend the manual validation for other smells to improve comparison
bull Extend the experimentation with other tools as CodeVizard Checkstyleand on different system as Ant
bull Improve the Marple Code Smell Detector tool through the lessons learned in particular
bull provide a clear detection technique and clear metrics theresholds
bull provide a metrics-based approach that incorporates tailored domain-specific detection rules
bull Analyze the impact of refactoring to remove code smells on some well known object-oriented quality metrics [Arcelli Spinelli WRT 2011 ICSE Workshop]
25-03-2011 An experience report on using code smells
detection tools
Future works-Impact of Refactoring
bull Our approach is based on the following steps 1 computing the metrics on a software system
2 detecting the code smell
3 automated refactoring for one smell
4 reapplying step 1
5 analysing the incrementdecrement for each metric value
6 reapplying step 3-5 for each smell
7 identifying the smells whose refactoring better improves the quality of the analysed system
bull We have considered metrics proposed in the literature to measure cohesion coupling and complexity of a system
bull We considered Feature Envy Long Method Shotgun Surgery Large Class
25-03-2011 An experience report on using code smells
detection tools
References
bull [1] F Arcelli M Zanoni ACaracciolo A benchmark platform for design patterns detection Procceedings of the PATTERNS 2010 Conference Lisboa Portugal November 2010
bull [2] F Arcelli M Zanoni A Tool for Design Pattern Detection and Software Architecture Reconstruction Information Sciences Elsevier doi101016jins2010
bull [3] CS-CheckStyle httpcheckstylesourceforgenetindexhtml
bull [4] Martin Fowler Refactoring Improving the Design of Existing Code Addison-Wesley Inc Boston MA USA 1999
bull [5] Hamza H Counsell S Hall T and Loizou G Code smell eradication and associated refactoring 2nd European Computing Conference 2008
bull [6] YGil I Maman Micro Patterns in Java Code Proc of the 20th annual ACM SIGPLAN conference OOPSLA 2005 October 2005
bull [7] M Lanza and R Marinescu Object-Oriented Metrics in Practice Springer-Verlag 2006
bull [8] InCode httpwwwintooituscominCodehtml
bull [9] InFusion httpwwwintooituscominFusionhtml
bull [10] iPlasma httplooseuptroiplasmaindexhtml
bull [11] Mika V Maumlntylauml Jari Vanhanen and Casper Lassenius Bad smells ndash humans as code critics Proc IEEE International Conference on Software Maintenance 0399ndash408 2004
bull [12] T Mens T Tourweacute A Survey of Software Refactoring IEEE Transactions on Software Engineering vol 30 no 2 2004
25-03-2011 An experience report on using code smells
detection tools
References
bull [13] Naouel MohaYann-Gael Gueheneuc Laurence Duchien Anne-Francoise Le Meur Decor a method for the specificatio and detection of code and design smells TSE IEEE CS Press 2010
bull [14] Naouel Moha Yann-Gael Guacuteehacuteeneuc Anne-Francoise Le MeurLaurence Duchien and Alban Tiberghien From a domain analysis to the specification and detection of code and design smells Formal Aspects of Computng 2009
bull [15] Emerson Murphy-Hill Chris Parnin and Andrew P Blac How we refactor and how we know it In ICSE rsquo09 Proceedings of the 31st International Conference on Software Engineering 2009
bull [16] Emerson Murphy-Hill and Andrew P Black An interactive ambient visualization for code smells Proceedings of SOFTVIS 10 USA October 2010
bull [17] C Marinescu R Marinescu P Mihancea D Ratiu and R Wettel iplasma An integrated platform for quality assessment of object-oriented design In Proceedings of 21st International Conference on Software Maintenance (ICSM 2005) Tools Section 2005
bull [18] Steffen Olbrich Daniela Cruzes Victor Basili Nico Zazworka CodeVizardA tool to aid the analysis of software evolution Proceedings ICSE 2010 South Africa
bull [19] PMD httppmdsourceforgenet
bull [20] httpesserediscounimibitreverseCodeSmells html
bull [21] Nikolaos Tsantalis Theodoros Chaikalis and Alexander Chatzigeorgiou JDeodorant Identification and removal of type-checking bad smells In Proceedings of CSMR 2008 pp 329ndash331
bull
25-03-2011 An experience report on using code smells
detection tools
Experiment set up
110 1101 1102 1103 1111
Packages 27 27 27 28 33
Classes 393 395 396 402 549
Methods 1913 1921 1924 1937 2724
25-03-2011 An experience report on using code smells
detection tools
GanttProject System
No standard benchmark for toolrsquos comparison is available
the authors of DECOR provided the precision and recall of a
detection technique on an open-source system (multi application
platform for planning and project management) and on a
representative set of six smells
Manual validation could be subjective
Experiment results- God Class
bull The Code smell Large Class detected by DECOR is equivalent to the God Class smell recognized by JDeodorant inFusion and iPlasma In fact both specifications define classes that are trying to do too much These classes also have low cohesion
1 They heavily access data of other simpler classes either directly or using accessor methods
2 They are large and complex
3 They have a lot of non-communicative behavior ie there is a low cohesion between the methods belonging to that class
25-03-2011 An experience report on using code smells
detection tools
God Class detection
1 Class uses directly more than a few attributes of other classes Since ATFD (Access to Foreign Data) measures how many foreign attributes are
used by the class it is clear that the higher the ATFD value for a class the higher is the probability that a class is (or is about to become) a God Class (the extent to which a class uses attributes of other classes)
ATFD gt a maximun number of tolerable foreign attributes to be used (FEW where FEW is considered as [2-5])
2 Functional complexity of the class is very high This is expressed using the WMC (Weighted Method Count) metric sum of the
statical complexity of all methods in a class (consider McCabersquos cyclomatic complexity metric as a complexity measure GREATER THAN VERY HIGH
3 Class cohesion is low As a God Class performs several distinct functionalities involving disjunct sets of attributes this has a negative impact on the classrsquos cohesion
Tight Class Cohesion (TCC) is the relative number of methods directly connected via accesses of attributes LESS than13 ([033]) less than one-third of the method pairs have in common the usage of the same attribute
25-03-2011 An experience report on using code smells
detection tools
Experiment results
bull As an example the following expression evaluates if the ldquoGod classrdquo smell is present
(WMCge 47) and (ATFD gt 5) and (TCC lt1 3)
bull where WMC weighted methods per class ATFD number of accesses to foreign class data and TCC tight class cohesion
bull For Jdeodorant the God Class is detected considering the number of line of code
25-03-2011 An experience report on using code smells
detection tools
Metrics theresholds examples -iPlasma
Metric LOW AVE HIGH VERY HIGH
LOCClass 28 70 130 195
WMC 5 14 31 47
LOCMethod 7 10 13 19
NOMClass 4 7 10 15
25-03-2011 An experience report on using code smells
detection tools
Experiment results
25-03-2011 An experience report on using code smells
detection tools
bull God Class Decor-Benchmark 9 God class
Table 9 God Class comparisons
110 1101 1102 1103 1111
JDeodorant 7 (178) 6 (151) 8 (202) 5 (124) 22 (403)
InFusion 11 (279)
11 (278)
11 (277)
11 (273)
13 (238)
iPlasma 10 (254)
10 (253)
10 (252)
10 (248)
13 (238)
Experiment results-Long Parameter List
bull PMD 65 LPL with 4 parameter (DECOR 54 LPL)
25-03-2011 An experience report on using code smells
detection tools
0
10
20
30
40
50
60
70
80
90
1100 1101 1102 1103 1111
Long Parameter list Comparison
PMD - TH 4 parameters
PMD - TH 5 parameters
Experiment results-Large Class
bull PMD ndash Line of code 415 (DECOR-9 Large Class)
25-03-2011 An experience report on using code smells
detection tools
0
2
4
6
8
10
12
14
16
1100 1101 1102 1103 1111
sm
ells
Large class
Threshold 1000
Threshold 800
Threshold 600
Threshold 500
Threshold 450
Threshold 415
Threshold 400
Experiment results-Code smell evolution
-
25-03-2011 An experience report on using code smells
detection tools
Lesson learned
bull A comparison of the tools is a complex task
ndash Computing the size of the system detection techniques the metrics theresholds refactoring link to the code tool interface
bull We aim to propose a new taxonomy of smells based on refinements of smells definition clear definition of the detection techniques (necessary and sufficient conditions)
bull We gained useful information to be exploited in a tool for code smell detection
25-03-2011 An experience report on using code smells
detection tools
MARPLE
25-03-2011 An experience report on using code smells
detection tools
Marple-Code smells Detector
Currently we are able to detect the following smells
1) Feature Envy (Jdeodorant iPlasma inFusion Marple)
2) Indecent Exposure (Marple)
3) Long Parameter List (Checkstyle PMD iPlasma Marple)
4) Refused Bequest (iPlasma Marple)
5) Data Class (iPlasma inFusion Marple)
6) Lazy Class (Marple)
Future smells to detect
Comments Duplicate Code
We are interested to provide the same validation for precisionrecall on GanttProject system 25-03-2011
An experience report on using code smells detection tools
Future works
bull Extend the manual validation for other smells to improve comparison
bull Extend the experimentation with other tools as CodeVizard Checkstyleand on different system as Ant
bull Improve the Marple Code Smell Detector tool through the lessons learned in particular
bull provide a clear detection technique and clear metrics theresholds
bull provide a metrics-based approach that incorporates tailored domain-specific detection rules
bull Analyze the impact of refactoring to remove code smells on some well known object-oriented quality metrics [Arcelli Spinelli WRT 2011 ICSE Workshop]
25-03-2011 An experience report on using code smells
detection tools
Future works-Impact of Refactoring
bull Our approach is based on the following steps 1 computing the metrics on a software system
2 detecting the code smell
3 automated refactoring for one smell
4 reapplying step 1
5 analysing the incrementdecrement for each metric value
6 reapplying step 3-5 for each smell
7 identifying the smells whose refactoring better improves the quality of the analysed system
bull We have considered metrics proposed in the literature to measure cohesion coupling and complexity of a system
bull We considered Feature Envy Long Method Shotgun Surgery Large Class
25-03-2011 An experience report on using code smells
detection tools
References
bull [1] F Arcelli M Zanoni ACaracciolo A benchmark platform for design patterns detection Procceedings of the PATTERNS 2010 Conference Lisboa Portugal November 2010
bull [2] F Arcelli M Zanoni A Tool for Design Pattern Detection and Software Architecture Reconstruction Information Sciences Elsevier doi101016jins2010
bull [3] CS-CheckStyle httpcheckstylesourceforgenetindexhtml
bull [4] Martin Fowler Refactoring Improving the Design of Existing Code Addison-Wesley Inc Boston MA USA 1999
bull [5] Hamza H Counsell S Hall T and Loizou G Code smell eradication and associated refactoring 2nd European Computing Conference 2008
bull [6] YGil I Maman Micro Patterns in Java Code Proc of the 20th annual ACM SIGPLAN conference OOPSLA 2005 October 2005
bull [7] M Lanza and R Marinescu Object-Oriented Metrics in Practice Springer-Verlag 2006
bull [8] InCode httpwwwintooituscominCodehtml
bull [9] InFusion httpwwwintooituscominFusionhtml
bull [10] iPlasma httplooseuptroiplasmaindexhtml
bull [11] Mika V Maumlntylauml Jari Vanhanen and Casper Lassenius Bad smells ndash humans as code critics Proc IEEE International Conference on Software Maintenance 0399ndash408 2004
bull [12] T Mens T Tourweacute A Survey of Software Refactoring IEEE Transactions on Software Engineering vol 30 no 2 2004
25-03-2011 An experience report on using code smells
detection tools
References
bull [13] Naouel MohaYann-Gael Gueheneuc Laurence Duchien Anne-Francoise Le Meur Decor a method for the specificatio and detection of code and design smells TSE IEEE CS Press 2010
bull [14] Naouel Moha Yann-Gael Guacuteehacuteeneuc Anne-Francoise Le MeurLaurence Duchien and Alban Tiberghien From a domain analysis to the specification and detection of code and design smells Formal Aspects of Computng 2009
bull [15] Emerson Murphy-Hill Chris Parnin and Andrew P Blac How we refactor and how we know it In ICSE rsquo09 Proceedings of the 31st International Conference on Software Engineering 2009
bull [16] Emerson Murphy-Hill and Andrew P Black An interactive ambient visualization for code smells Proceedings of SOFTVIS 10 USA October 2010
bull [17] C Marinescu R Marinescu P Mihancea D Ratiu and R Wettel iplasma An integrated platform for quality assessment of object-oriented design In Proceedings of 21st International Conference on Software Maintenance (ICSM 2005) Tools Section 2005
bull [18] Steffen Olbrich Daniela Cruzes Victor Basili Nico Zazworka CodeVizardA tool to aid the analysis of software evolution Proceedings ICSE 2010 South Africa
bull [19] PMD httppmdsourceforgenet
bull [20] httpesserediscounimibitreverseCodeSmells html
bull [21] Nikolaos Tsantalis Theodoros Chaikalis and Alexander Chatzigeorgiou JDeodorant Identification and removal of type-checking bad smells In Proceedings of CSMR 2008 pp 329ndash331
bull
25-03-2011 An experience report on using code smells
detection tools
Experiment results- God Class
bull The Code smell Large Class detected by DECOR is equivalent to the God Class smell recognized by JDeodorant inFusion and iPlasma In fact both specifications define classes that are trying to do too much These classes also have low cohesion
1 They heavily access data of other simpler classes either directly or using accessor methods
2 They are large and complex
3 They have a lot of non-communicative behavior ie there is a low cohesion between the methods belonging to that class
25-03-2011 An experience report on using code smells
detection tools
God Class detection
1 Class uses directly more than a few attributes of other classes Since ATFD (Access to Foreign Data) measures how many foreign attributes are
used by the class it is clear that the higher the ATFD value for a class the higher is the probability that a class is (or is about to become) a God Class (the extent to which a class uses attributes of other classes)
ATFD gt a maximun number of tolerable foreign attributes to be used (FEW where FEW is considered as [2-5])
2 Functional complexity of the class is very high This is expressed using the WMC (Weighted Method Count) metric sum of the
statical complexity of all methods in a class (consider McCabersquos cyclomatic complexity metric as a complexity measure GREATER THAN VERY HIGH
3 Class cohesion is low As a God Class performs several distinct functionalities involving disjunct sets of attributes this has a negative impact on the classrsquos cohesion
Tight Class Cohesion (TCC) is the relative number of methods directly connected via accesses of attributes LESS than13 ([033]) less than one-third of the method pairs have in common the usage of the same attribute
25-03-2011 An experience report on using code smells
detection tools
Experiment results
bull As an example the following expression evaluates if the ldquoGod classrdquo smell is present
(WMCge 47) and (ATFD gt 5) and (TCC lt1 3)
bull where WMC weighted methods per class ATFD number of accesses to foreign class data and TCC tight class cohesion
bull For Jdeodorant the God Class is detected considering the number of line of code
25-03-2011 An experience report on using code smells
detection tools
Metrics theresholds examples -iPlasma
Metric LOW AVE HIGH VERY HIGH
LOCClass 28 70 130 195
WMC 5 14 31 47
LOCMethod 7 10 13 19
NOMClass 4 7 10 15
25-03-2011 An experience report on using code smells
detection tools
Experiment results
25-03-2011 An experience report on using code smells
detection tools
bull God Class Decor-Benchmark 9 God class
Table 9 God Class comparisons
110 1101 1102 1103 1111
JDeodorant 7 (178) 6 (151) 8 (202) 5 (124) 22 (403)
InFusion 11 (279)
11 (278)
11 (277)
11 (273)
13 (238)
iPlasma 10 (254)
10 (253)
10 (252)
10 (248)
13 (238)
Experiment results-Long Parameter List
bull PMD 65 LPL with 4 parameter (DECOR 54 LPL)
25-03-2011 An experience report on using code smells
detection tools
0
10
20
30
40
50
60
70
80
90
1100 1101 1102 1103 1111
Long Parameter list Comparison
PMD - TH 4 parameters
PMD - TH 5 parameters
Experiment results-Large Class
bull PMD ndash Line of code 415 (DECOR-9 Large Class)
25-03-2011 An experience report on using code smells
detection tools
0
2
4
6
8
10
12
14
16
1100 1101 1102 1103 1111
sm
ells
Large class
Threshold 1000
Threshold 800
Threshold 600
Threshold 500
Threshold 450
Threshold 415
Threshold 400
Experiment results-Code smell evolution
-
25-03-2011 An experience report on using code smells
detection tools
Lesson learned
bull A comparison of the tools is a complex task
ndash Computing the size of the system detection techniques the metrics theresholds refactoring link to the code tool interface
bull We aim to propose a new taxonomy of smells based on refinements of smells definition clear definition of the detection techniques (necessary and sufficient conditions)
bull We gained useful information to be exploited in a tool for code smell detection
25-03-2011 An experience report on using code smells
detection tools
MARPLE
25-03-2011 An experience report on using code smells
detection tools
Marple-Code smells Detector
Currently we are able to detect the following smells
1) Feature Envy (Jdeodorant iPlasma inFusion Marple)
2) Indecent Exposure (Marple)
3) Long Parameter List (Checkstyle PMD iPlasma Marple)
4) Refused Bequest (iPlasma Marple)
5) Data Class (iPlasma inFusion Marple)
6) Lazy Class (Marple)
Future smells to detect
Comments Duplicate Code
We are interested to provide the same validation for precisionrecall on GanttProject system 25-03-2011
An experience report on using code smells detection tools
Future works
bull Extend the manual validation for other smells to improve comparison
bull Extend the experimentation with other tools as CodeVizard Checkstyleand on different system as Ant
bull Improve the Marple Code Smell Detector tool through the lessons learned in particular
bull provide a clear detection technique and clear metrics theresholds
bull provide a metrics-based approach that incorporates tailored domain-specific detection rules
bull Analyze the impact of refactoring to remove code smells on some well known object-oriented quality metrics [Arcelli Spinelli WRT 2011 ICSE Workshop]
25-03-2011 An experience report on using code smells
detection tools
Future works-Impact of Refactoring
bull Our approach is based on the following steps 1 computing the metrics on a software system
2 detecting the code smell
3 automated refactoring for one smell
4 reapplying step 1
5 analysing the incrementdecrement for each metric value
6 reapplying step 3-5 for each smell
7 identifying the smells whose refactoring better improves the quality of the analysed system
bull We have considered metrics proposed in the literature to measure cohesion coupling and complexity of a system
bull We considered Feature Envy Long Method Shotgun Surgery Large Class
25-03-2011 An experience report on using code smells
detection tools
References
bull [1] F Arcelli M Zanoni ACaracciolo A benchmark platform for design patterns detection Procceedings of the PATTERNS 2010 Conference Lisboa Portugal November 2010
bull [2] F Arcelli M Zanoni A Tool for Design Pattern Detection and Software Architecture Reconstruction Information Sciences Elsevier doi101016jins2010
bull [3] CS-CheckStyle httpcheckstylesourceforgenetindexhtml
bull [4] Martin Fowler Refactoring Improving the Design of Existing Code Addison-Wesley Inc Boston MA USA 1999
bull [5] Hamza H Counsell S Hall T and Loizou G Code smell eradication and associated refactoring 2nd European Computing Conference 2008
bull [6] YGil I Maman Micro Patterns in Java Code Proc of the 20th annual ACM SIGPLAN conference OOPSLA 2005 October 2005
bull [7] M Lanza and R Marinescu Object-Oriented Metrics in Practice Springer-Verlag 2006
bull [8] InCode httpwwwintooituscominCodehtml
bull [9] InFusion httpwwwintooituscominFusionhtml
bull [10] iPlasma httplooseuptroiplasmaindexhtml
bull [11] Mika V Maumlntylauml Jari Vanhanen and Casper Lassenius Bad smells ndash humans as code critics Proc IEEE International Conference on Software Maintenance 0399ndash408 2004
bull [12] T Mens T Tourweacute A Survey of Software Refactoring IEEE Transactions on Software Engineering vol 30 no 2 2004
25-03-2011 An experience report on using code smells
detection tools
References
bull [13] Naouel MohaYann-Gael Gueheneuc Laurence Duchien Anne-Francoise Le Meur Decor a method for the specificatio and detection of code and design smells TSE IEEE CS Press 2010
bull [14] Naouel Moha Yann-Gael Guacuteehacuteeneuc Anne-Francoise Le MeurLaurence Duchien and Alban Tiberghien From a domain analysis to the specification and detection of code and design smells Formal Aspects of Computng 2009
bull [15] Emerson Murphy-Hill Chris Parnin and Andrew P Blac How we refactor and how we know it In ICSE rsquo09 Proceedings of the 31st International Conference on Software Engineering 2009
bull [16] Emerson Murphy-Hill and Andrew P Black An interactive ambient visualization for code smells Proceedings of SOFTVIS 10 USA October 2010
bull [17] C Marinescu R Marinescu P Mihancea D Ratiu and R Wettel iplasma An integrated platform for quality assessment of object-oriented design In Proceedings of 21st International Conference on Software Maintenance (ICSM 2005) Tools Section 2005
bull [18] Steffen Olbrich Daniela Cruzes Victor Basili Nico Zazworka CodeVizardA tool to aid the analysis of software evolution Proceedings ICSE 2010 South Africa
bull [19] PMD httppmdsourceforgenet
bull [20] httpesserediscounimibitreverseCodeSmells html
bull [21] Nikolaos Tsantalis Theodoros Chaikalis and Alexander Chatzigeorgiou JDeodorant Identification and removal of type-checking bad smells In Proceedings of CSMR 2008 pp 329ndash331
bull
25-03-2011 An experience report on using code smells
detection tools
God Class detection
1 Class uses directly more than a few attributes of other classes Since ATFD (Access to Foreign Data) measures how many foreign attributes are
used by the class it is clear that the higher the ATFD value for a class the higher is the probability that a class is (or is about to become) a God Class (the extent to which a class uses attributes of other classes)
ATFD gt a maximun number of tolerable foreign attributes to be used (FEW where FEW is considered as [2-5])
2 Functional complexity of the class is very high This is expressed using the WMC (Weighted Method Count) metric sum of the
statical complexity of all methods in a class (consider McCabersquos cyclomatic complexity metric as a complexity measure GREATER THAN VERY HIGH
3 Class cohesion is low As a God Class performs several distinct functionalities involving disjunct sets of attributes this has a negative impact on the classrsquos cohesion
Tight Class Cohesion (TCC) is the relative number of methods directly connected via accesses of attributes LESS than13 ([033]) less than one-third of the method pairs have in common the usage of the same attribute
25-03-2011 An experience report on using code smells
detection tools
Experiment results
bull As an example the following expression evaluates if the ldquoGod classrdquo smell is present
(WMCge 47) and (ATFD gt 5) and (TCC lt1 3)
bull where WMC weighted methods per class ATFD number of accesses to foreign class data and TCC tight class cohesion
bull For Jdeodorant the God Class is detected considering the number of line of code
25-03-2011 An experience report on using code smells
detection tools
Metrics theresholds examples -iPlasma
Metric LOW AVE HIGH VERY HIGH
LOCClass 28 70 130 195
WMC 5 14 31 47
LOCMethod 7 10 13 19
NOMClass 4 7 10 15
25-03-2011 An experience report on using code smells
detection tools
Experiment results
25-03-2011 An experience report on using code smells
detection tools
bull God Class Decor-Benchmark 9 God class
Table 9 God Class comparisons
110 1101 1102 1103 1111
JDeodorant 7 (178) 6 (151) 8 (202) 5 (124) 22 (403)
InFusion 11 (279)
11 (278)
11 (277)
11 (273)
13 (238)
iPlasma 10 (254)
10 (253)
10 (252)
10 (248)
13 (238)
Experiment results-Long Parameter List
bull PMD 65 LPL with 4 parameter (DECOR 54 LPL)
25-03-2011 An experience report on using code smells
detection tools
0
10
20
30
40
50
60
70
80
90
1100 1101 1102 1103 1111
Long Parameter list Comparison
PMD - TH 4 parameters
PMD - TH 5 parameters
Experiment results-Large Class
bull PMD ndash Line of code 415 (DECOR-9 Large Class)
25-03-2011 An experience report on using code smells
detection tools
0
2
4
6
8
10
12
14
16
1100 1101 1102 1103 1111
sm
ells
Large class
Threshold 1000
Threshold 800
Threshold 600
Threshold 500
Threshold 450
Threshold 415
Threshold 400
Experiment results-Code smell evolution
-
25-03-2011 An experience report on using code smells
detection tools
Lesson learned
bull A comparison of the tools is a complex task
ndash Computing the size of the system detection techniques the metrics theresholds refactoring link to the code tool interface
bull We aim to propose a new taxonomy of smells based on refinements of smells definition clear definition of the detection techniques (necessary and sufficient conditions)
bull We gained useful information to be exploited in a tool for code smell detection
25-03-2011 An experience report on using code smells
detection tools
MARPLE
25-03-2011 An experience report on using code smells
detection tools
Marple-Code smells Detector
Currently we are able to detect the following smells
1) Feature Envy (Jdeodorant iPlasma inFusion Marple)
2) Indecent Exposure (Marple)
3) Long Parameter List (Checkstyle PMD iPlasma Marple)
4) Refused Bequest (iPlasma Marple)
5) Data Class (iPlasma inFusion Marple)
6) Lazy Class (Marple)
Future smells to detect
Comments Duplicate Code
We are interested to provide the same validation for precisionrecall on GanttProject system 25-03-2011
An experience report on using code smells detection tools
Future works
bull Extend the manual validation for other smells to improve comparison
bull Extend the experimentation with other tools as CodeVizard Checkstyleand on different system as Ant
bull Improve the Marple Code Smell Detector tool through the lessons learned in particular
bull provide a clear detection technique and clear metrics theresholds
bull provide a metrics-based approach that incorporates tailored domain-specific detection rules
bull Analyze the impact of refactoring to remove code smells on some well known object-oriented quality metrics [Arcelli Spinelli WRT 2011 ICSE Workshop]
25-03-2011 An experience report on using code smells
detection tools
Future works-Impact of Refactoring
bull Our approach is based on the following steps 1 computing the metrics on a software system
2 detecting the code smell
3 automated refactoring for one smell
4 reapplying step 1
5 analysing the incrementdecrement for each metric value
6 reapplying step 3-5 for each smell
7 identifying the smells whose refactoring better improves the quality of the analysed system
bull We have considered metrics proposed in the literature to measure cohesion coupling and complexity of a system
bull We considered Feature Envy Long Method Shotgun Surgery Large Class
25-03-2011 An experience report on using code smells
detection tools
References
bull [1] F Arcelli M Zanoni ACaracciolo A benchmark platform for design patterns detection Procceedings of the PATTERNS 2010 Conference Lisboa Portugal November 2010
bull [2] F Arcelli M Zanoni A Tool for Design Pattern Detection and Software Architecture Reconstruction Information Sciences Elsevier doi101016jins2010
bull [3] CS-CheckStyle httpcheckstylesourceforgenetindexhtml
bull [4] Martin Fowler Refactoring Improving the Design of Existing Code Addison-Wesley Inc Boston MA USA 1999
bull [5] Hamza H Counsell S Hall T and Loizou G Code smell eradication and associated refactoring 2nd European Computing Conference 2008
bull [6] YGil I Maman Micro Patterns in Java Code Proc of the 20th annual ACM SIGPLAN conference OOPSLA 2005 October 2005
bull [7] M Lanza and R Marinescu Object-Oriented Metrics in Practice Springer-Verlag 2006
bull [8] InCode httpwwwintooituscominCodehtml
bull [9] InFusion httpwwwintooituscominFusionhtml
bull [10] iPlasma httplooseuptroiplasmaindexhtml
bull [11] Mika V Maumlntylauml Jari Vanhanen and Casper Lassenius Bad smells ndash humans as code critics Proc IEEE International Conference on Software Maintenance 0399ndash408 2004
bull [12] T Mens T Tourweacute A Survey of Software Refactoring IEEE Transactions on Software Engineering vol 30 no 2 2004
25-03-2011 An experience report on using code smells
detection tools
References
bull [13] Naouel MohaYann-Gael Gueheneuc Laurence Duchien Anne-Francoise Le Meur Decor a method for the specificatio and detection of code and design smells TSE IEEE CS Press 2010
bull [14] Naouel Moha Yann-Gael Guacuteehacuteeneuc Anne-Francoise Le MeurLaurence Duchien and Alban Tiberghien From a domain analysis to the specification and detection of code and design smells Formal Aspects of Computng 2009
bull [15] Emerson Murphy-Hill Chris Parnin and Andrew P Blac How we refactor and how we know it In ICSE rsquo09 Proceedings of the 31st International Conference on Software Engineering 2009
bull [16] Emerson Murphy-Hill and Andrew P Black An interactive ambient visualization for code smells Proceedings of SOFTVIS 10 USA October 2010
bull [17] C Marinescu R Marinescu P Mihancea D Ratiu and R Wettel iplasma An integrated platform for quality assessment of object-oriented design In Proceedings of 21st International Conference on Software Maintenance (ICSM 2005) Tools Section 2005
bull [18] Steffen Olbrich Daniela Cruzes Victor Basili Nico Zazworka CodeVizardA tool to aid the analysis of software evolution Proceedings ICSE 2010 South Africa
bull [19] PMD httppmdsourceforgenet
bull [20] httpesserediscounimibitreverseCodeSmells html
bull [21] Nikolaos Tsantalis Theodoros Chaikalis and Alexander Chatzigeorgiou JDeodorant Identification and removal of type-checking bad smells In Proceedings of CSMR 2008 pp 329ndash331
bull
25-03-2011 An experience report on using code smells
detection tools
Experiment results
bull As an example the following expression evaluates if the ldquoGod classrdquo smell is present
(WMCge 47) and (ATFD gt 5) and (TCC lt1 3)
bull where WMC weighted methods per class ATFD number of accesses to foreign class data and TCC tight class cohesion
bull For Jdeodorant the God Class is detected considering the number of line of code
25-03-2011 An experience report on using code smells
detection tools
Metrics theresholds examples -iPlasma
Metric LOW AVE HIGH VERY HIGH
LOCClass 28 70 130 195
WMC 5 14 31 47
LOCMethod 7 10 13 19
NOMClass 4 7 10 15
25-03-2011 An experience report on using code smells
detection tools
Experiment results
25-03-2011 An experience report on using code smells
detection tools
bull God Class Decor-Benchmark 9 God class
Table 9 God Class comparisons
110 1101 1102 1103 1111
JDeodorant 7 (178) 6 (151) 8 (202) 5 (124) 22 (403)
InFusion 11 (279)
11 (278)
11 (277)
11 (273)
13 (238)
iPlasma 10 (254)
10 (253)
10 (252)
10 (248)
13 (238)
Experiment results-Long Parameter List
bull PMD 65 LPL with 4 parameter (DECOR 54 LPL)
25-03-2011 An experience report on using code smells
detection tools
0
10
20
30
40
50
60
70
80
90
1100 1101 1102 1103 1111
Long Parameter list Comparison
PMD - TH 4 parameters
PMD - TH 5 parameters
Experiment results-Large Class
bull PMD ndash Line of code 415 (DECOR-9 Large Class)
25-03-2011 An experience report on using code smells
detection tools
0
2
4
6
8
10
12
14
16
1100 1101 1102 1103 1111
sm
ells
Large class
Threshold 1000
Threshold 800
Threshold 600
Threshold 500
Threshold 450
Threshold 415
Threshold 400
Experiment results-Code smell evolution
-
25-03-2011 An experience report on using code smells
detection tools
Lesson learned
bull A comparison of the tools is a complex task
ndash Computing the size of the system detection techniques the metrics theresholds refactoring link to the code tool interface
bull We aim to propose a new taxonomy of smells based on refinements of smells definition clear definition of the detection techniques (necessary and sufficient conditions)
bull We gained useful information to be exploited in a tool for code smell detection
25-03-2011 An experience report on using code smells
detection tools
MARPLE
25-03-2011 An experience report on using code smells
detection tools
Marple-Code smells Detector
Currently we are able to detect the following smells
1) Feature Envy (Jdeodorant iPlasma inFusion Marple)
2) Indecent Exposure (Marple)
3) Long Parameter List (Checkstyle PMD iPlasma Marple)
4) Refused Bequest (iPlasma Marple)
5) Data Class (iPlasma inFusion Marple)
6) Lazy Class (Marple)
Future smells to detect
Comments Duplicate Code
We are interested to provide the same validation for precisionrecall on GanttProject system 25-03-2011
An experience report on using code smells detection tools
Future works
bull Extend the manual validation for other smells to improve comparison
bull Extend the experimentation with other tools as CodeVizard Checkstyleand on different system as Ant
bull Improve the Marple Code Smell Detector tool through the lessons learned in particular
bull provide a clear detection technique and clear metrics theresholds
bull provide a metrics-based approach that incorporates tailored domain-specific detection rules
bull Analyze the impact of refactoring to remove code smells on some well known object-oriented quality metrics [Arcelli Spinelli WRT 2011 ICSE Workshop]
25-03-2011 An experience report on using code smells
detection tools
Future works-Impact of Refactoring
bull Our approach is based on the following steps 1 computing the metrics on a software system
2 detecting the code smell
3 automated refactoring for one smell
4 reapplying step 1
5 analysing the incrementdecrement for each metric value
6 reapplying step 3-5 for each smell
7 identifying the smells whose refactoring better improves the quality of the analysed system
bull We have considered metrics proposed in the literature to measure cohesion coupling and complexity of a system
bull We considered Feature Envy Long Method Shotgun Surgery Large Class
25-03-2011 An experience report on using code smells
detection tools
References
bull [1] F Arcelli M Zanoni ACaracciolo A benchmark platform for design patterns detection Procceedings of the PATTERNS 2010 Conference Lisboa Portugal November 2010
bull [2] F Arcelli M Zanoni A Tool for Design Pattern Detection and Software Architecture Reconstruction Information Sciences Elsevier doi101016jins2010
bull [3] CS-CheckStyle httpcheckstylesourceforgenetindexhtml
bull [4] Martin Fowler Refactoring Improving the Design of Existing Code Addison-Wesley Inc Boston MA USA 1999
bull [5] Hamza H Counsell S Hall T and Loizou G Code smell eradication and associated refactoring 2nd European Computing Conference 2008
bull [6] YGil I Maman Micro Patterns in Java Code Proc of the 20th annual ACM SIGPLAN conference OOPSLA 2005 October 2005
bull [7] M Lanza and R Marinescu Object-Oriented Metrics in Practice Springer-Verlag 2006
bull [8] InCode httpwwwintooituscominCodehtml
bull [9] InFusion httpwwwintooituscominFusionhtml
bull [10] iPlasma httplooseuptroiplasmaindexhtml
bull [11] Mika V Maumlntylauml Jari Vanhanen and Casper Lassenius Bad smells ndash humans as code critics Proc IEEE International Conference on Software Maintenance 0399ndash408 2004
bull [12] T Mens T Tourweacute A Survey of Software Refactoring IEEE Transactions on Software Engineering vol 30 no 2 2004
25-03-2011 An experience report on using code smells
detection tools
References
bull [13] Naouel MohaYann-Gael Gueheneuc Laurence Duchien Anne-Francoise Le Meur Decor a method for the specificatio and detection of code and design smells TSE IEEE CS Press 2010
bull [14] Naouel Moha Yann-Gael Guacuteehacuteeneuc Anne-Francoise Le MeurLaurence Duchien and Alban Tiberghien From a domain analysis to the specification and detection of code and design smells Formal Aspects of Computng 2009
bull [15] Emerson Murphy-Hill Chris Parnin and Andrew P Blac How we refactor and how we know it In ICSE rsquo09 Proceedings of the 31st International Conference on Software Engineering 2009
bull [16] Emerson Murphy-Hill and Andrew P Black An interactive ambient visualization for code smells Proceedings of SOFTVIS 10 USA October 2010
bull [17] C Marinescu R Marinescu P Mihancea D Ratiu and R Wettel iplasma An integrated platform for quality assessment of object-oriented design In Proceedings of 21st International Conference on Software Maintenance (ICSM 2005) Tools Section 2005
bull [18] Steffen Olbrich Daniela Cruzes Victor Basili Nico Zazworka CodeVizardA tool to aid the analysis of software evolution Proceedings ICSE 2010 South Africa
bull [19] PMD httppmdsourceforgenet
bull [20] httpesserediscounimibitreverseCodeSmells html
bull [21] Nikolaos Tsantalis Theodoros Chaikalis and Alexander Chatzigeorgiou JDeodorant Identification and removal of type-checking bad smells In Proceedings of CSMR 2008 pp 329ndash331
bull
25-03-2011 An experience report on using code smells
detection tools
Metrics theresholds examples -iPlasma
Metric LOW AVE HIGH VERY HIGH
LOCClass 28 70 130 195
WMC 5 14 31 47
LOCMethod 7 10 13 19
NOMClass 4 7 10 15
25-03-2011 An experience report on using code smells
detection tools
Experiment results
25-03-2011 An experience report on using code smells
detection tools
bull God Class Decor-Benchmark 9 God class
Table 9 God Class comparisons
110 1101 1102 1103 1111
JDeodorant 7 (178) 6 (151) 8 (202) 5 (124) 22 (403)
InFusion 11 (279)
11 (278)
11 (277)
11 (273)
13 (238)
iPlasma 10 (254)
10 (253)
10 (252)
10 (248)
13 (238)
Experiment results-Long Parameter List
bull PMD 65 LPL with 4 parameter (DECOR 54 LPL)
25-03-2011 An experience report on using code smells
detection tools
0
10
20
30
40
50
60
70
80
90
1100 1101 1102 1103 1111
Long Parameter list Comparison
PMD - TH 4 parameters
PMD - TH 5 parameters
Experiment results-Large Class
bull PMD ndash Line of code 415 (DECOR-9 Large Class)
25-03-2011 An experience report on using code smells
detection tools
0
2
4
6
8
10
12
14
16
1100 1101 1102 1103 1111
sm
ells
Large class
Threshold 1000
Threshold 800
Threshold 600
Threshold 500
Threshold 450
Threshold 415
Threshold 400
Experiment results-Code smell evolution
-
25-03-2011 An experience report on using code smells
detection tools
Lesson learned
bull A comparison of the tools is a complex task
ndash Computing the size of the system detection techniques the metrics theresholds refactoring link to the code tool interface
bull We aim to propose a new taxonomy of smells based on refinements of smells definition clear definition of the detection techniques (necessary and sufficient conditions)
bull We gained useful information to be exploited in a tool for code smell detection
25-03-2011 An experience report on using code smells
detection tools
MARPLE
25-03-2011 An experience report on using code smells
detection tools
Marple-Code smells Detector
Currently we are able to detect the following smells
1) Feature Envy (Jdeodorant iPlasma inFusion Marple)
2) Indecent Exposure (Marple)
3) Long Parameter List (Checkstyle PMD iPlasma Marple)
4) Refused Bequest (iPlasma Marple)
5) Data Class (iPlasma inFusion Marple)
6) Lazy Class (Marple)
Future smells to detect
Comments Duplicate Code
We are interested to provide the same validation for precisionrecall on GanttProject system 25-03-2011
An experience report on using code smells detection tools
Future works
bull Extend the manual validation for other smells to improve comparison
bull Extend the experimentation with other tools as CodeVizard Checkstyleand on different system as Ant
bull Improve the Marple Code Smell Detector tool through the lessons learned in particular
bull provide a clear detection technique and clear metrics theresholds
bull provide a metrics-based approach that incorporates tailored domain-specific detection rules
bull Analyze the impact of refactoring to remove code smells on some well known object-oriented quality metrics [Arcelli Spinelli WRT 2011 ICSE Workshop]
25-03-2011 An experience report on using code smells
detection tools
Future works-Impact of Refactoring
bull Our approach is based on the following steps 1 computing the metrics on a software system
2 detecting the code smell
3 automated refactoring for one smell
4 reapplying step 1
5 analysing the incrementdecrement for each metric value
6 reapplying step 3-5 for each smell
7 identifying the smells whose refactoring better improves the quality of the analysed system
bull We have considered metrics proposed in the literature to measure cohesion coupling and complexity of a system
bull We considered Feature Envy Long Method Shotgun Surgery Large Class
25-03-2011 An experience report on using code smells
detection tools
References
bull [1] F Arcelli M Zanoni ACaracciolo A benchmark platform for design patterns detection Procceedings of the PATTERNS 2010 Conference Lisboa Portugal November 2010
bull [2] F Arcelli M Zanoni A Tool for Design Pattern Detection and Software Architecture Reconstruction Information Sciences Elsevier doi101016jins2010
bull [3] CS-CheckStyle httpcheckstylesourceforgenetindexhtml
bull [4] Martin Fowler Refactoring Improving the Design of Existing Code Addison-Wesley Inc Boston MA USA 1999
bull [5] Hamza H Counsell S Hall T and Loizou G Code smell eradication and associated refactoring 2nd European Computing Conference 2008
bull [6] YGil I Maman Micro Patterns in Java Code Proc of the 20th annual ACM SIGPLAN conference OOPSLA 2005 October 2005
bull [7] M Lanza and R Marinescu Object-Oriented Metrics in Practice Springer-Verlag 2006
bull [8] InCode httpwwwintooituscominCodehtml
bull [9] InFusion httpwwwintooituscominFusionhtml
bull [10] iPlasma httplooseuptroiplasmaindexhtml
bull [11] Mika V Maumlntylauml Jari Vanhanen and Casper Lassenius Bad smells ndash humans as code critics Proc IEEE International Conference on Software Maintenance 0399ndash408 2004
bull [12] T Mens T Tourweacute A Survey of Software Refactoring IEEE Transactions on Software Engineering vol 30 no 2 2004
25-03-2011 An experience report on using code smells
detection tools
References
bull [13] Naouel MohaYann-Gael Gueheneuc Laurence Duchien Anne-Francoise Le Meur Decor a method for the specificatio and detection of code and design smells TSE IEEE CS Press 2010
bull [14] Naouel Moha Yann-Gael Guacuteehacuteeneuc Anne-Francoise Le MeurLaurence Duchien and Alban Tiberghien From a domain analysis to the specification and detection of code and design smells Formal Aspects of Computng 2009
bull [15] Emerson Murphy-Hill Chris Parnin and Andrew P Blac How we refactor and how we know it In ICSE rsquo09 Proceedings of the 31st International Conference on Software Engineering 2009
bull [16] Emerson Murphy-Hill and Andrew P Black An interactive ambient visualization for code smells Proceedings of SOFTVIS 10 USA October 2010
bull [17] C Marinescu R Marinescu P Mihancea D Ratiu and R Wettel iplasma An integrated platform for quality assessment of object-oriented design In Proceedings of 21st International Conference on Software Maintenance (ICSM 2005) Tools Section 2005
bull [18] Steffen Olbrich Daniela Cruzes Victor Basili Nico Zazworka CodeVizardA tool to aid the analysis of software evolution Proceedings ICSE 2010 South Africa
bull [19] PMD httppmdsourceforgenet
bull [20] httpesserediscounimibitreverseCodeSmells html
bull [21] Nikolaos Tsantalis Theodoros Chaikalis and Alexander Chatzigeorgiou JDeodorant Identification and removal of type-checking bad smells In Proceedings of CSMR 2008 pp 329ndash331
bull
25-03-2011 An experience report on using code smells
detection tools
Experiment results
25-03-2011 An experience report on using code smells
detection tools
bull God Class Decor-Benchmark 9 God class
Table 9 God Class comparisons
110 1101 1102 1103 1111
JDeodorant 7 (178) 6 (151) 8 (202) 5 (124) 22 (403)
InFusion 11 (279)
11 (278)
11 (277)
11 (273)
13 (238)
iPlasma 10 (254)
10 (253)
10 (252)
10 (248)
13 (238)
Experiment results-Long Parameter List
bull PMD 65 LPL with 4 parameter (DECOR 54 LPL)
25-03-2011 An experience report on using code smells
detection tools
0
10
20
30
40
50
60
70
80
90
1100 1101 1102 1103 1111
Long Parameter list Comparison
PMD - TH 4 parameters
PMD - TH 5 parameters
Experiment results-Large Class
bull PMD ndash Line of code 415 (DECOR-9 Large Class)
25-03-2011 An experience report on using code smells
detection tools
0
2
4
6
8
10
12
14
16
1100 1101 1102 1103 1111
sm
ells
Large class
Threshold 1000
Threshold 800
Threshold 600
Threshold 500
Threshold 450
Threshold 415
Threshold 400
Experiment results-Code smell evolution
-
25-03-2011 An experience report on using code smells
detection tools
Lesson learned
bull A comparison of the tools is a complex task
ndash Computing the size of the system detection techniques the metrics theresholds refactoring link to the code tool interface
bull We aim to propose a new taxonomy of smells based on refinements of smells definition clear definition of the detection techniques (necessary and sufficient conditions)
bull We gained useful information to be exploited in a tool for code smell detection
25-03-2011 An experience report on using code smells
detection tools
MARPLE
25-03-2011 An experience report on using code smells
detection tools
Marple-Code smells Detector
Currently we are able to detect the following smells
1) Feature Envy (Jdeodorant iPlasma inFusion Marple)
2) Indecent Exposure (Marple)
3) Long Parameter List (Checkstyle PMD iPlasma Marple)
4) Refused Bequest (iPlasma Marple)
5) Data Class (iPlasma inFusion Marple)
6) Lazy Class (Marple)
Future smells to detect
Comments Duplicate Code
We are interested to provide the same validation for precisionrecall on GanttProject system 25-03-2011
An experience report on using code smells detection tools
Future works
bull Extend the manual validation for other smells to improve comparison
bull Extend the experimentation with other tools as CodeVizard Checkstyleand on different system as Ant
bull Improve the Marple Code Smell Detector tool through the lessons learned in particular
bull provide a clear detection technique and clear metrics theresholds
bull provide a metrics-based approach that incorporates tailored domain-specific detection rules
bull Analyze the impact of refactoring to remove code smells on some well known object-oriented quality metrics [Arcelli Spinelli WRT 2011 ICSE Workshop]
25-03-2011 An experience report on using code smells
detection tools
Future works-Impact of Refactoring
bull Our approach is based on the following steps 1 computing the metrics on a software system
2 detecting the code smell
3 automated refactoring for one smell
4 reapplying step 1
5 analysing the incrementdecrement for each metric value
6 reapplying step 3-5 for each smell
7 identifying the smells whose refactoring better improves the quality of the analysed system
bull We have considered metrics proposed in the literature to measure cohesion coupling and complexity of a system
bull We considered Feature Envy Long Method Shotgun Surgery Large Class
25-03-2011 An experience report on using code smells
detection tools
References
bull [1] F Arcelli M Zanoni ACaracciolo A benchmark platform for design patterns detection Procceedings of the PATTERNS 2010 Conference Lisboa Portugal November 2010
bull [2] F Arcelli M Zanoni A Tool for Design Pattern Detection and Software Architecture Reconstruction Information Sciences Elsevier doi101016jins2010
bull [3] CS-CheckStyle httpcheckstylesourceforgenetindexhtml
bull [4] Martin Fowler Refactoring Improving the Design of Existing Code Addison-Wesley Inc Boston MA USA 1999
bull [5] Hamza H Counsell S Hall T and Loizou G Code smell eradication and associated refactoring 2nd European Computing Conference 2008
bull [6] YGil I Maman Micro Patterns in Java Code Proc of the 20th annual ACM SIGPLAN conference OOPSLA 2005 October 2005
bull [7] M Lanza and R Marinescu Object-Oriented Metrics in Practice Springer-Verlag 2006
bull [8] InCode httpwwwintooituscominCodehtml
bull [9] InFusion httpwwwintooituscominFusionhtml
bull [10] iPlasma httplooseuptroiplasmaindexhtml
bull [11] Mika V Maumlntylauml Jari Vanhanen and Casper Lassenius Bad smells ndash humans as code critics Proc IEEE International Conference on Software Maintenance 0399ndash408 2004
bull [12] T Mens T Tourweacute A Survey of Software Refactoring IEEE Transactions on Software Engineering vol 30 no 2 2004
25-03-2011 An experience report on using code smells
detection tools
References
bull [13] Naouel MohaYann-Gael Gueheneuc Laurence Duchien Anne-Francoise Le Meur Decor a method for the specificatio and detection of code and design smells TSE IEEE CS Press 2010
bull [14] Naouel Moha Yann-Gael Guacuteehacuteeneuc Anne-Francoise Le MeurLaurence Duchien and Alban Tiberghien From a domain analysis to the specification and detection of code and design smells Formal Aspects of Computng 2009
bull [15] Emerson Murphy-Hill Chris Parnin and Andrew P Blac How we refactor and how we know it In ICSE rsquo09 Proceedings of the 31st International Conference on Software Engineering 2009
bull [16] Emerson Murphy-Hill and Andrew P Black An interactive ambient visualization for code smells Proceedings of SOFTVIS 10 USA October 2010
bull [17] C Marinescu R Marinescu P Mihancea D Ratiu and R Wettel iplasma An integrated platform for quality assessment of object-oriented design In Proceedings of 21st International Conference on Software Maintenance (ICSM 2005) Tools Section 2005
bull [18] Steffen Olbrich Daniela Cruzes Victor Basili Nico Zazworka CodeVizardA tool to aid the analysis of software evolution Proceedings ICSE 2010 South Africa
bull [19] PMD httppmdsourceforgenet
bull [20] httpesserediscounimibitreverseCodeSmells html
bull [21] Nikolaos Tsantalis Theodoros Chaikalis and Alexander Chatzigeorgiou JDeodorant Identification and removal of type-checking bad smells In Proceedings of CSMR 2008 pp 329ndash331
bull
25-03-2011 An experience report on using code smells
detection tools
Experiment results-Long Parameter List
bull PMD 65 LPL with 4 parameter (DECOR 54 LPL)
25-03-2011 An experience report on using code smells
detection tools
0
10
20
30
40
50
60
70
80
90
1100 1101 1102 1103 1111
Long Parameter list Comparison
PMD - TH 4 parameters
PMD - TH 5 parameters
Experiment results-Large Class
bull PMD ndash Line of code 415 (DECOR-9 Large Class)
25-03-2011 An experience report on using code smells
detection tools
0
2
4
6
8
10
12
14
16
1100 1101 1102 1103 1111
sm
ells
Large class
Threshold 1000
Threshold 800
Threshold 600
Threshold 500
Threshold 450
Threshold 415
Threshold 400
Experiment results-Code smell evolution
-
25-03-2011 An experience report on using code smells
detection tools
Lesson learned
bull A comparison of the tools is a complex task
ndash Computing the size of the system detection techniques the metrics theresholds refactoring link to the code tool interface
bull We aim to propose a new taxonomy of smells based on refinements of smells definition clear definition of the detection techniques (necessary and sufficient conditions)
bull We gained useful information to be exploited in a tool for code smell detection
25-03-2011 An experience report on using code smells
detection tools
MARPLE
25-03-2011 An experience report on using code smells
detection tools
Marple-Code smells Detector
Currently we are able to detect the following smells
1) Feature Envy (Jdeodorant iPlasma inFusion Marple)
2) Indecent Exposure (Marple)
3) Long Parameter List (Checkstyle PMD iPlasma Marple)
4) Refused Bequest (iPlasma Marple)
5) Data Class (iPlasma inFusion Marple)
6) Lazy Class (Marple)
Future smells to detect
Comments Duplicate Code
We are interested to provide the same validation for precisionrecall on GanttProject system 25-03-2011
An experience report on using code smells detection tools
Future works
bull Extend the manual validation for other smells to improve comparison
bull Extend the experimentation with other tools as CodeVizard Checkstyleand on different system as Ant
bull Improve the Marple Code Smell Detector tool through the lessons learned in particular
bull provide a clear detection technique and clear metrics theresholds
bull provide a metrics-based approach that incorporates tailored domain-specific detection rules
bull Analyze the impact of refactoring to remove code smells on some well known object-oriented quality metrics [Arcelli Spinelli WRT 2011 ICSE Workshop]
25-03-2011 An experience report on using code smells
detection tools
Future works-Impact of Refactoring
bull Our approach is based on the following steps 1 computing the metrics on a software system
2 detecting the code smell
3 automated refactoring for one smell
4 reapplying step 1
5 analysing the incrementdecrement for each metric value
6 reapplying step 3-5 for each smell
7 identifying the smells whose refactoring better improves the quality of the analysed system
bull We have considered metrics proposed in the literature to measure cohesion coupling and complexity of a system
bull We considered Feature Envy Long Method Shotgun Surgery Large Class
25-03-2011 An experience report on using code smells
detection tools
References
bull [1] F Arcelli M Zanoni ACaracciolo A benchmark platform for design patterns detection Procceedings of the PATTERNS 2010 Conference Lisboa Portugal November 2010
bull [2] F Arcelli M Zanoni A Tool for Design Pattern Detection and Software Architecture Reconstruction Information Sciences Elsevier doi101016jins2010
bull [3] CS-CheckStyle httpcheckstylesourceforgenetindexhtml
bull [4] Martin Fowler Refactoring Improving the Design of Existing Code Addison-Wesley Inc Boston MA USA 1999
bull [5] Hamza H Counsell S Hall T and Loizou G Code smell eradication and associated refactoring 2nd European Computing Conference 2008
bull [6] YGil I Maman Micro Patterns in Java Code Proc of the 20th annual ACM SIGPLAN conference OOPSLA 2005 October 2005
bull [7] M Lanza and R Marinescu Object-Oriented Metrics in Practice Springer-Verlag 2006
bull [8] InCode httpwwwintooituscominCodehtml
bull [9] InFusion httpwwwintooituscominFusionhtml
bull [10] iPlasma httplooseuptroiplasmaindexhtml
bull [11] Mika V Maumlntylauml Jari Vanhanen and Casper Lassenius Bad smells ndash humans as code critics Proc IEEE International Conference on Software Maintenance 0399ndash408 2004
bull [12] T Mens T Tourweacute A Survey of Software Refactoring IEEE Transactions on Software Engineering vol 30 no 2 2004
25-03-2011 An experience report on using code smells
detection tools
References
bull [13] Naouel MohaYann-Gael Gueheneuc Laurence Duchien Anne-Francoise Le Meur Decor a method for the specificatio and detection of code and design smells TSE IEEE CS Press 2010
bull [14] Naouel Moha Yann-Gael Guacuteehacuteeneuc Anne-Francoise Le MeurLaurence Duchien and Alban Tiberghien From a domain analysis to the specification and detection of code and design smells Formal Aspects of Computng 2009
bull [15] Emerson Murphy-Hill Chris Parnin and Andrew P Blac How we refactor and how we know it In ICSE rsquo09 Proceedings of the 31st International Conference on Software Engineering 2009
bull [16] Emerson Murphy-Hill and Andrew P Black An interactive ambient visualization for code smells Proceedings of SOFTVIS 10 USA October 2010
bull [17] C Marinescu R Marinescu P Mihancea D Ratiu and R Wettel iplasma An integrated platform for quality assessment of object-oriented design In Proceedings of 21st International Conference on Software Maintenance (ICSM 2005) Tools Section 2005
bull [18] Steffen Olbrich Daniela Cruzes Victor Basili Nico Zazworka CodeVizardA tool to aid the analysis of software evolution Proceedings ICSE 2010 South Africa
bull [19] PMD httppmdsourceforgenet
bull [20] httpesserediscounimibitreverseCodeSmells html
bull [21] Nikolaos Tsantalis Theodoros Chaikalis and Alexander Chatzigeorgiou JDeodorant Identification and removal of type-checking bad smells In Proceedings of CSMR 2008 pp 329ndash331
bull
25-03-2011 An experience report on using code smells
detection tools
Experiment results-Large Class
bull PMD ndash Line of code 415 (DECOR-9 Large Class)
25-03-2011 An experience report on using code smells
detection tools
0
2
4
6
8
10
12
14
16
1100 1101 1102 1103 1111
sm
ells
Large class
Threshold 1000
Threshold 800
Threshold 600
Threshold 500
Threshold 450
Threshold 415
Threshold 400
Experiment results-Code smell evolution
-
25-03-2011 An experience report on using code smells
detection tools
Lesson learned
bull A comparison of the tools is a complex task
ndash Computing the size of the system detection techniques the metrics theresholds refactoring link to the code tool interface
bull We aim to propose a new taxonomy of smells based on refinements of smells definition clear definition of the detection techniques (necessary and sufficient conditions)
bull We gained useful information to be exploited in a tool for code smell detection
25-03-2011 An experience report on using code smells
detection tools
MARPLE
25-03-2011 An experience report on using code smells
detection tools
Marple-Code smells Detector
Currently we are able to detect the following smells
1) Feature Envy (Jdeodorant iPlasma inFusion Marple)
2) Indecent Exposure (Marple)
3) Long Parameter List (Checkstyle PMD iPlasma Marple)
4) Refused Bequest (iPlasma Marple)
5) Data Class (iPlasma inFusion Marple)
6) Lazy Class (Marple)
Future smells to detect
Comments Duplicate Code
We are interested to provide the same validation for precisionrecall on GanttProject system 25-03-2011
An experience report on using code smells detection tools
Future works
bull Extend the manual validation for other smells to improve comparison
bull Extend the experimentation with other tools as CodeVizard Checkstyleand on different system as Ant
bull Improve the Marple Code Smell Detector tool through the lessons learned in particular
bull provide a clear detection technique and clear metrics theresholds
bull provide a metrics-based approach that incorporates tailored domain-specific detection rules
bull Analyze the impact of refactoring to remove code smells on some well known object-oriented quality metrics [Arcelli Spinelli WRT 2011 ICSE Workshop]
25-03-2011 An experience report on using code smells
detection tools
Future works-Impact of Refactoring
bull Our approach is based on the following steps 1 computing the metrics on a software system
2 detecting the code smell
3 automated refactoring for one smell
4 reapplying step 1
5 analysing the incrementdecrement for each metric value
6 reapplying step 3-5 for each smell
7 identifying the smells whose refactoring better improves the quality of the analysed system
bull We have considered metrics proposed in the literature to measure cohesion coupling and complexity of a system
bull We considered Feature Envy Long Method Shotgun Surgery Large Class
25-03-2011 An experience report on using code smells
detection tools
References
bull [1] F Arcelli M Zanoni ACaracciolo A benchmark platform for design patterns detection Procceedings of the PATTERNS 2010 Conference Lisboa Portugal November 2010
bull [2] F Arcelli M Zanoni A Tool for Design Pattern Detection and Software Architecture Reconstruction Information Sciences Elsevier doi101016jins2010
bull [3] CS-CheckStyle httpcheckstylesourceforgenetindexhtml
bull [4] Martin Fowler Refactoring Improving the Design of Existing Code Addison-Wesley Inc Boston MA USA 1999
bull [5] Hamza H Counsell S Hall T and Loizou G Code smell eradication and associated refactoring 2nd European Computing Conference 2008
bull [6] YGil I Maman Micro Patterns in Java Code Proc of the 20th annual ACM SIGPLAN conference OOPSLA 2005 October 2005
bull [7] M Lanza and R Marinescu Object-Oriented Metrics in Practice Springer-Verlag 2006
bull [8] InCode httpwwwintooituscominCodehtml
bull [9] InFusion httpwwwintooituscominFusionhtml
bull [10] iPlasma httplooseuptroiplasmaindexhtml
bull [11] Mika V Maumlntylauml Jari Vanhanen and Casper Lassenius Bad smells ndash humans as code critics Proc IEEE International Conference on Software Maintenance 0399ndash408 2004
bull [12] T Mens T Tourweacute A Survey of Software Refactoring IEEE Transactions on Software Engineering vol 30 no 2 2004
25-03-2011 An experience report on using code smells
detection tools
References
bull [13] Naouel MohaYann-Gael Gueheneuc Laurence Duchien Anne-Francoise Le Meur Decor a method for the specificatio and detection of code and design smells TSE IEEE CS Press 2010
bull [14] Naouel Moha Yann-Gael Guacuteehacuteeneuc Anne-Francoise Le MeurLaurence Duchien and Alban Tiberghien From a domain analysis to the specification and detection of code and design smells Formal Aspects of Computng 2009
bull [15] Emerson Murphy-Hill Chris Parnin and Andrew P Blac How we refactor and how we know it In ICSE rsquo09 Proceedings of the 31st International Conference on Software Engineering 2009
bull [16] Emerson Murphy-Hill and Andrew P Black An interactive ambient visualization for code smells Proceedings of SOFTVIS 10 USA October 2010
bull [17] C Marinescu R Marinescu P Mihancea D Ratiu and R Wettel iplasma An integrated platform for quality assessment of object-oriented design In Proceedings of 21st International Conference on Software Maintenance (ICSM 2005) Tools Section 2005
bull [18] Steffen Olbrich Daniela Cruzes Victor Basili Nico Zazworka CodeVizardA tool to aid the analysis of software evolution Proceedings ICSE 2010 South Africa
bull [19] PMD httppmdsourceforgenet
bull [20] httpesserediscounimibitreverseCodeSmells html
bull [21] Nikolaos Tsantalis Theodoros Chaikalis and Alexander Chatzigeorgiou JDeodorant Identification and removal of type-checking bad smells In Proceedings of CSMR 2008 pp 329ndash331
bull
25-03-2011 An experience report on using code smells
detection tools
Experiment results-Code smell evolution
-
25-03-2011 An experience report on using code smells
detection tools
Lesson learned
bull A comparison of the tools is a complex task
ndash Computing the size of the system detection techniques the metrics theresholds refactoring link to the code tool interface
bull We aim to propose a new taxonomy of smells based on refinements of smells definition clear definition of the detection techniques (necessary and sufficient conditions)
bull We gained useful information to be exploited in a tool for code smell detection
25-03-2011 An experience report on using code smells
detection tools
MARPLE
25-03-2011 An experience report on using code smells
detection tools
Marple-Code smells Detector
Currently we are able to detect the following smells
1) Feature Envy (Jdeodorant iPlasma inFusion Marple)
2) Indecent Exposure (Marple)
3) Long Parameter List (Checkstyle PMD iPlasma Marple)
4) Refused Bequest (iPlasma Marple)
5) Data Class (iPlasma inFusion Marple)
6) Lazy Class (Marple)
Future smells to detect
Comments Duplicate Code
We are interested to provide the same validation for precisionrecall on GanttProject system 25-03-2011
An experience report on using code smells detection tools
Future works
bull Extend the manual validation for other smells to improve comparison
bull Extend the experimentation with other tools as CodeVizard Checkstyleand on different system as Ant
bull Improve the Marple Code Smell Detector tool through the lessons learned in particular
bull provide a clear detection technique and clear metrics theresholds
bull provide a metrics-based approach that incorporates tailored domain-specific detection rules
bull Analyze the impact of refactoring to remove code smells on some well known object-oriented quality metrics [Arcelli Spinelli WRT 2011 ICSE Workshop]
25-03-2011 An experience report on using code smells
detection tools
Future works-Impact of Refactoring
bull Our approach is based on the following steps 1 computing the metrics on a software system
2 detecting the code smell
3 automated refactoring for one smell
4 reapplying step 1
5 analysing the incrementdecrement for each metric value
6 reapplying step 3-5 for each smell
7 identifying the smells whose refactoring better improves the quality of the analysed system
bull We have considered metrics proposed in the literature to measure cohesion coupling and complexity of a system
bull We considered Feature Envy Long Method Shotgun Surgery Large Class
25-03-2011 An experience report on using code smells
detection tools
References
bull [1] F Arcelli M Zanoni ACaracciolo A benchmark platform for design patterns detection Procceedings of the PATTERNS 2010 Conference Lisboa Portugal November 2010
bull [2] F Arcelli M Zanoni A Tool for Design Pattern Detection and Software Architecture Reconstruction Information Sciences Elsevier doi101016jins2010
bull [3] CS-CheckStyle httpcheckstylesourceforgenetindexhtml
bull [4] Martin Fowler Refactoring Improving the Design of Existing Code Addison-Wesley Inc Boston MA USA 1999
bull [5] Hamza H Counsell S Hall T and Loizou G Code smell eradication and associated refactoring 2nd European Computing Conference 2008
bull [6] YGil I Maman Micro Patterns in Java Code Proc of the 20th annual ACM SIGPLAN conference OOPSLA 2005 October 2005
bull [7] M Lanza and R Marinescu Object-Oriented Metrics in Practice Springer-Verlag 2006
bull [8] InCode httpwwwintooituscominCodehtml
bull [9] InFusion httpwwwintooituscominFusionhtml
bull [10] iPlasma httplooseuptroiplasmaindexhtml
bull [11] Mika V Maumlntylauml Jari Vanhanen and Casper Lassenius Bad smells ndash humans as code critics Proc IEEE International Conference on Software Maintenance 0399ndash408 2004
bull [12] T Mens T Tourweacute A Survey of Software Refactoring IEEE Transactions on Software Engineering vol 30 no 2 2004
25-03-2011 An experience report on using code smells
detection tools
References
bull [13] Naouel MohaYann-Gael Gueheneuc Laurence Duchien Anne-Francoise Le Meur Decor a method for the specificatio and detection of code and design smells TSE IEEE CS Press 2010
bull [14] Naouel Moha Yann-Gael Guacuteehacuteeneuc Anne-Francoise Le MeurLaurence Duchien and Alban Tiberghien From a domain analysis to the specification and detection of code and design smells Formal Aspects of Computng 2009
bull [15] Emerson Murphy-Hill Chris Parnin and Andrew P Blac How we refactor and how we know it In ICSE rsquo09 Proceedings of the 31st International Conference on Software Engineering 2009
bull [16] Emerson Murphy-Hill and Andrew P Black An interactive ambient visualization for code smells Proceedings of SOFTVIS 10 USA October 2010
bull [17] C Marinescu R Marinescu P Mihancea D Ratiu and R Wettel iplasma An integrated platform for quality assessment of object-oriented design In Proceedings of 21st International Conference on Software Maintenance (ICSM 2005) Tools Section 2005
bull [18] Steffen Olbrich Daniela Cruzes Victor Basili Nico Zazworka CodeVizardA tool to aid the analysis of software evolution Proceedings ICSE 2010 South Africa
bull [19] PMD httppmdsourceforgenet
bull [20] httpesserediscounimibitreverseCodeSmells html
bull [21] Nikolaos Tsantalis Theodoros Chaikalis and Alexander Chatzigeorgiou JDeodorant Identification and removal of type-checking bad smells In Proceedings of CSMR 2008 pp 329ndash331
bull
25-03-2011 An experience report on using code smells
detection tools
Lesson learned
bull A comparison of the tools is a complex task
ndash Computing the size of the system detection techniques the metrics theresholds refactoring link to the code tool interface
bull We aim to propose a new taxonomy of smells based on refinements of smells definition clear definition of the detection techniques (necessary and sufficient conditions)
bull We gained useful information to be exploited in a tool for code smell detection
25-03-2011 An experience report on using code smells
detection tools
MARPLE
25-03-2011 An experience report on using code smells
detection tools
Marple-Code smells Detector
Currently we are able to detect the following smells
1) Feature Envy (Jdeodorant iPlasma inFusion Marple)
2) Indecent Exposure (Marple)
3) Long Parameter List (Checkstyle PMD iPlasma Marple)
4) Refused Bequest (iPlasma Marple)
5) Data Class (iPlasma inFusion Marple)
6) Lazy Class (Marple)
Future smells to detect
Comments Duplicate Code
We are interested to provide the same validation for precisionrecall on GanttProject system 25-03-2011
An experience report on using code smells detection tools
Future works
bull Extend the manual validation for other smells to improve comparison
bull Extend the experimentation with other tools as CodeVizard Checkstyleand on different system as Ant
bull Improve the Marple Code Smell Detector tool through the lessons learned in particular
bull provide a clear detection technique and clear metrics theresholds
bull provide a metrics-based approach that incorporates tailored domain-specific detection rules
bull Analyze the impact of refactoring to remove code smells on some well known object-oriented quality metrics [Arcelli Spinelli WRT 2011 ICSE Workshop]
25-03-2011 An experience report on using code smells
detection tools
Future works-Impact of Refactoring
bull Our approach is based on the following steps 1 computing the metrics on a software system
2 detecting the code smell
3 automated refactoring for one smell
4 reapplying step 1
5 analysing the incrementdecrement for each metric value
6 reapplying step 3-5 for each smell
7 identifying the smells whose refactoring better improves the quality of the analysed system
bull We have considered metrics proposed in the literature to measure cohesion coupling and complexity of a system
bull We considered Feature Envy Long Method Shotgun Surgery Large Class
25-03-2011 An experience report on using code smells
detection tools
References
bull [1] F Arcelli M Zanoni ACaracciolo A benchmark platform for design patterns detection Procceedings of the PATTERNS 2010 Conference Lisboa Portugal November 2010
bull [2] F Arcelli M Zanoni A Tool for Design Pattern Detection and Software Architecture Reconstruction Information Sciences Elsevier doi101016jins2010
bull [3] CS-CheckStyle httpcheckstylesourceforgenetindexhtml
bull [4] Martin Fowler Refactoring Improving the Design of Existing Code Addison-Wesley Inc Boston MA USA 1999
bull [5] Hamza H Counsell S Hall T and Loizou G Code smell eradication and associated refactoring 2nd European Computing Conference 2008
bull [6] YGil I Maman Micro Patterns in Java Code Proc of the 20th annual ACM SIGPLAN conference OOPSLA 2005 October 2005
bull [7] M Lanza and R Marinescu Object-Oriented Metrics in Practice Springer-Verlag 2006
bull [8] InCode httpwwwintooituscominCodehtml
bull [9] InFusion httpwwwintooituscominFusionhtml
bull [10] iPlasma httplooseuptroiplasmaindexhtml
bull [11] Mika V Maumlntylauml Jari Vanhanen and Casper Lassenius Bad smells ndash humans as code critics Proc IEEE International Conference on Software Maintenance 0399ndash408 2004
bull [12] T Mens T Tourweacute A Survey of Software Refactoring IEEE Transactions on Software Engineering vol 30 no 2 2004
25-03-2011 An experience report on using code smells
detection tools
References
bull [13] Naouel MohaYann-Gael Gueheneuc Laurence Duchien Anne-Francoise Le Meur Decor a method for the specificatio and detection of code and design smells TSE IEEE CS Press 2010
bull [14] Naouel Moha Yann-Gael Guacuteehacuteeneuc Anne-Francoise Le MeurLaurence Duchien and Alban Tiberghien From a domain analysis to the specification and detection of code and design smells Formal Aspects of Computng 2009
bull [15] Emerson Murphy-Hill Chris Parnin and Andrew P Blac How we refactor and how we know it In ICSE rsquo09 Proceedings of the 31st International Conference on Software Engineering 2009
bull [16] Emerson Murphy-Hill and Andrew P Black An interactive ambient visualization for code smells Proceedings of SOFTVIS 10 USA October 2010
bull [17] C Marinescu R Marinescu P Mihancea D Ratiu and R Wettel iplasma An integrated platform for quality assessment of object-oriented design In Proceedings of 21st International Conference on Software Maintenance (ICSM 2005) Tools Section 2005
bull [18] Steffen Olbrich Daniela Cruzes Victor Basili Nico Zazworka CodeVizardA tool to aid the analysis of software evolution Proceedings ICSE 2010 South Africa
bull [19] PMD httppmdsourceforgenet
bull [20] httpesserediscounimibitreverseCodeSmells html
bull [21] Nikolaos Tsantalis Theodoros Chaikalis and Alexander Chatzigeorgiou JDeodorant Identification and removal of type-checking bad smells In Proceedings of CSMR 2008 pp 329ndash331
bull
25-03-2011 An experience report on using code smells
detection tools
MARPLE
25-03-2011 An experience report on using code smells
detection tools
Marple-Code smells Detector
Currently we are able to detect the following smells
1) Feature Envy (Jdeodorant iPlasma inFusion Marple)
2) Indecent Exposure (Marple)
3) Long Parameter List (Checkstyle PMD iPlasma Marple)
4) Refused Bequest (iPlasma Marple)
5) Data Class (iPlasma inFusion Marple)
6) Lazy Class (Marple)
Future smells to detect
Comments Duplicate Code
We are interested to provide the same validation for precisionrecall on GanttProject system 25-03-2011
An experience report on using code smells detection tools
Future works
bull Extend the manual validation for other smells to improve comparison
bull Extend the experimentation with other tools as CodeVizard Checkstyleand on different system as Ant
bull Improve the Marple Code Smell Detector tool through the lessons learned in particular
bull provide a clear detection technique and clear metrics theresholds
bull provide a metrics-based approach that incorporates tailored domain-specific detection rules
bull Analyze the impact of refactoring to remove code smells on some well known object-oriented quality metrics [Arcelli Spinelli WRT 2011 ICSE Workshop]
25-03-2011 An experience report on using code smells
detection tools
Future works-Impact of Refactoring
bull Our approach is based on the following steps 1 computing the metrics on a software system
2 detecting the code smell
3 automated refactoring for one smell
4 reapplying step 1
5 analysing the incrementdecrement for each metric value
6 reapplying step 3-5 for each smell
7 identifying the smells whose refactoring better improves the quality of the analysed system
bull We have considered metrics proposed in the literature to measure cohesion coupling and complexity of a system
bull We considered Feature Envy Long Method Shotgun Surgery Large Class
25-03-2011 An experience report on using code smells
detection tools
References
bull [1] F Arcelli M Zanoni ACaracciolo A benchmark platform for design patterns detection Procceedings of the PATTERNS 2010 Conference Lisboa Portugal November 2010
bull [2] F Arcelli M Zanoni A Tool for Design Pattern Detection and Software Architecture Reconstruction Information Sciences Elsevier doi101016jins2010
bull [3] CS-CheckStyle httpcheckstylesourceforgenetindexhtml
bull [4] Martin Fowler Refactoring Improving the Design of Existing Code Addison-Wesley Inc Boston MA USA 1999
bull [5] Hamza H Counsell S Hall T and Loizou G Code smell eradication and associated refactoring 2nd European Computing Conference 2008
bull [6] YGil I Maman Micro Patterns in Java Code Proc of the 20th annual ACM SIGPLAN conference OOPSLA 2005 October 2005
bull [7] M Lanza and R Marinescu Object-Oriented Metrics in Practice Springer-Verlag 2006
bull [8] InCode httpwwwintooituscominCodehtml
bull [9] InFusion httpwwwintooituscominFusionhtml
bull [10] iPlasma httplooseuptroiplasmaindexhtml
bull [11] Mika V Maumlntylauml Jari Vanhanen and Casper Lassenius Bad smells ndash humans as code critics Proc IEEE International Conference on Software Maintenance 0399ndash408 2004
bull [12] T Mens T Tourweacute A Survey of Software Refactoring IEEE Transactions on Software Engineering vol 30 no 2 2004
25-03-2011 An experience report on using code smells
detection tools
References
bull [13] Naouel MohaYann-Gael Gueheneuc Laurence Duchien Anne-Francoise Le Meur Decor a method for the specificatio and detection of code and design smells TSE IEEE CS Press 2010
bull [14] Naouel Moha Yann-Gael Guacuteehacuteeneuc Anne-Francoise Le MeurLaurence Duchien and Alban Tiberghien From a domain analysis to the specification and detection of code and design smells Formal Aspects of Computng 2009
bull [15] Emerson Murphy-Hill Chris Parnin and Andrew P Blac How we refactor and how we know it In ICSE rsquo09 Proceedings of the 31st International Conference on Software Engineering 2009
bull [16] Emerson Murphy-Hill and Andrew P Black An interactive ambient visualization for code smells Proceedings of SOFTVIS 10 USA October 2010
bull [17] C Marinescu R Marinescu P Mihancea D Ratiu and R Wettel iplasma An integrated platform for quality assessment of object-oriented design In Proceedings of 21st International Conference on Software Maintenance (ICSM 2005) Tools Section 2005
bull [18] Steffen Olbrich Daniela Cruzes Victor Basili Nico Zazworka CodeVizardA tool to aid the analysis of software evolution Proceedings ICSE 2010 South Africa
bull [19] PMD httppmdsourceforgenet
bull [20] httpesserediscounimibitreverseCodeSmells html
bull [21] Nikolaos Tsantalis Theodoros Chaikalis and Alexander Chatzigeorgiou JDeodorant Identification and removal of type-checking bad smells In Proceedings of CSMR 2008 pp 329ndash331
bull
25-03-2011 An experience report on using code smells
detection tools
Marple-Code smells Detector
Currently we are able to detect the following smells
1) Feature Envy (Jdeodorant iPlasma inFusion Marple)
2) Indecent Exposure (Marple)
3) Long Parameter List (Checkstyle PMD iPlasma Marple)
4) Refused Bequest (iPlasma Marple)
5) Data Class (iPlasma inFusion Marple)
6) Lazy Class (Marple)
Future smells to detect
Comments Duplicate Code
We are interested to provide the same validation for precisionrecall on GanttProject system 25-03-2011
An experience report on using code smells detection tools
Future works
bull Extend the manual validation for other smells to improve comparison
bull Extend the experimentation with other tools as CodeVizard Checkstyleand on different system as Ant
bull Improve the Marple Code Smell Detector tool through the lessons learned in particular
bull provide a clear detection technique and clear metrics theresholds
bull provide a metrics-based approach that incorporates tailored domain-specific detection rules
bull Analyze the impact of refactoring to remove code smells on some well known object-oriented quality metrics [Arcelli Spinelli WRT 2011 ICSE Workshop]
25-03-2011 An experience report on using code smells
detection tools
Future works-Impact of Refactoring
bull Our approach is based on the following steps 1 computing the metrics on a software system
2 detecting the code smell
3 automated refactoring for one smell
4 reapplying step 1
5 analysing the incrementdecrement for each metric value
6 reapplying step 3-5 for each smell
7 identifying the smells whose refactoring better improves the quality of the analysed system
bull We have considered metrics proposed in the literature to measure cohesion coupling and complexity of a system
bull We considered Feature Envy Long Method Shotgun Surgery Large Class
25-03-2011 An experience report on using code smells
detection tools
References
bull [1] F Arcelli M Zanoni ACaracciolo A benchmark platform for design patterns detection Procceedings of the PATTERNS 2010 Conference Lisboa Portugal November 2010
bull [2] F Arcelli M Zanoni A Tool for Design Pattern Detection and Software Architecture Reconstruction Information Sciences Elsevier doi101016jins2010
bull [3] CS-CheckStyle httpcheckstylesourceforgenetindexhtml
bull [4] Martin Fowler Refactoring Improving the Design of Existing Code Addison-Wesley Inc Boston MA USA 1999
bull [5] Hamza H Counsell S Hall T and Loizou G Code smell eradication and associated refactoring 2nd European Computing Conference 2008
bull [6] YGil I Maman Micro Patterns in Java Code Proc of the 20th annual ACM SIGPLAN conference OOPSLA 2005 October 2005
bull [7] M Lanza and R Marinescu Object-Oriented Metrics in Practice Springer-Verlag 2006
bull [8] InCode httpwwwintooituscominCodehtml
bull [9] InFusion httpwwwintooituscominFusionhtml
bull [10] iPlasma httplooseuptroiplasmaindexhtml
bull [11] Mika V Maumlntylauml Jari Vanhanen and Casper Lassenius Bad smells ndash humans as code critics Proc IEEE International Conference on Software Maintenance 0399ndash408 2004
bull [12] T Mens T Tourweacute A Survey of Software Refactoring IEEE Transactions on Software Engineering vol 30 no 2 2004
25-03-2011 An experience report on using code smells
detection tools
References
bull [13] Naouel MohaYann-Gael Gueheneuc Laurence Duchien Anne-Francoise Le Meur Decor a method for the specificatio and detection of code and design smells TSE IEEE CS Press 2010
bull [14] Naouel Moha Yann-Gael Guacuteehacuteeneuc Anne-Francoise Le MeurLaurence Duchien and Alban Tiberghien From a domain analysis to the specification and detection of code and design smells Formal Aspects of Computng 2009
bull [15] Emerson Murphy-Hill Chris Parnin and Andrew P Blac How we refactor and how we know it In ICSE rsquo09 Proceedings of the 31st International Conference on Software Engineering 2009
bull [16] Emerson Murphy-Hill and Andrew P Black An interactive ambient visualization for code smells Proceedings of SOFTVIS 10 USA October 2010
bull [17] C Marinescu R Marinescu P Mihancea D Ratiu and R Wettel iplasma An integrated platform for quality assessment of object-oriented design In Proceedings of 21st International Conference on Software Maintenance (ICSM 2005) Tools Section 2005
bull [18] Steffen Olbrich Daniela Cruzes Victor Basili Nico Zazworka CodeVizardA tool to aid the analysis of software evolution Proceedings ICSE 2010 South Africa
bull [19] PMD httppmdsourceforgenet
bull [20] httpesserediscounimibitreverseCodeSmells html
bull [21] Nikolaos Tsantalis Theodoros Chaikalis and Alexander Chatzigeorgiou JDeodorant Identification and removal of type-checking bad smells In Proceedings of CSMR 2008 pp 329ndash331
bull
25-03-2011 An experience report on using code smells
detection tools
Future works
bull Extend the manual validation for other smells to improve comparison
bull Extend the experimentation with other tools as CodeVizard Checkstyleand on different system as Ant
bull Improve the Marple Code Smell Detector tool through the lessons learned in particular
bull provide a clear detection technique and clear metrics theresholds
bull provide a metrics-based approach that incorporates tailored domain-specific detection rules
bull Analyze the impact of refactoring to remove code smells on some well known object-oriented quality metrics [Arcelli Spinelli WRT 2011 ICSE Workshop]
25-03-2011 An experience report on using code smells
detection tools
Future works-Impact of Refactoring
bull Our approach is based on the following steps 1 computing the metrics on a software system
2 detecting the code smell
3 automated refactoring for one smell
4 reapplying step 1
5 analysing the incrementdecrement for each metric value
6 reapplying step 3-5 for each smell
7 identifying the smells whose refactoring better improves the quality of the analysed system
bull We have considered metrics proposed in the literature to measure cohesion coupling and complexity of a system
bull We considered Feature Envy Long Method Shotgun Surgery Large Class
25-03-2011 An experience report on using code smells
detection tools
References
bull [1] F Arcelli M Zanoni ACaracciolo A benchmark platform for design patterns detection Procceedings of the PATTERNS 2010 Conference Lisboa Portugal November 2010
bull [2] F Arcelli M Zanoni A Tool for Design Pattern Detection and Software Architecture Reconstruction Information Sciences Elsevier doi101016jins2010
bull [3] CS-CheckStyle httpcheckstylesourceforgenetindexhtml
bull [4] Martin Fowler Refactoring Improving the Design of Existing Code Addison-Wesley Inc Boston MA USA 1999
bull [5] Hamza H Counsell S Hall T and Loizou G Code smell eradication and associated refactoring 2nd European Computing Conference 2008
bull [6] YGil I Maman Micro Patterns in Java Code Proc of the 20th annual ACM SIGPLAN conference OOPSLA 2005 October 2005
bull [7] M Lanza and R Marinescu Object-Oriented Metrics in Practice Springer-Verlag 2006
bull [8] InCode httpwwwintooituscominCodehtml
bull [9] InFusion httpwwwintooituscominFusionhtml
bull [10] iPlasma httplooseuptroiplasmaindexhtml
bull [11] Mika V Maumlntylauml Jari Vanhanen and Casper Lassenius Bad smells ndash humans as code critics Proc IEEE International Conference on Software Maintenance 0399ndash408 2004
bull [12] T Mens T Tourweacute A Survey of Software Refactoring IEEE Transactions on Software Engineering vol 30 no 2 2004
25-03-2011 An experience report on using code smells
detection tools
References
bull [13] Naouel MohaYann-Gael Gueheneuc Laurence Duchien Anne-Francoise Le Meur Decor a method for the specificatio and detection of code and design smells TSE IEEE CS Press 2010
bull [14] Naouel Moha Yann-Gael Guacuteehacuteeneuc Anne-Francoise Le MeurLaurence Duchien and Alban Tiberghien From a domain analysis to the specification and detection of code and design smells Formal Aspects of Computng 2009
bull [15] Emerson Murphy-Hill Chris Parnin and Andrew P Blac How we refactor and how we know it In ICSE rsquo09 Proceedings of the 31st International Conference on Software Engineering 2009
bull [16] Emerson Murphy-Hill and Andrew P Black An interactive ambient visualization for code smells Proceedings of SOFTVIS 10 USA October 2010
bull [17] C Marinescu R Marinescu P Mihancea D Ratiu and R Wettel iplasma An integrated platform for quality assessment of object-oriented design In Proceedings of 21st International Conference on Software Maintenance (ICSM 2005) Tools Section 2005
bull [18] Steffen Olbrich Daniela Cruzes Victor Basili Nico Zazworka CodeVizardA tool to aid the analysis of software evolution Proceedings ICSE 2010 South Africa
bull [19] PMD httppmdsourceforgenet
bull [20] httpesserediscounimibitreverseCodeSmells html
bull [21] Nikolaos Tsantalis Theodoros Chaikalis and Alexander Chatzigeorgiou JDeodorant Identification and removal of type-checking bad smells In Proceedings of CSMR 2008 pp 329ndash331
bull
25-03-2011 An experience report on using code smells
detection tools
Future works-Impact of Refactoring
bull Our approach is based on the following steps 1 computing the metrics on a software system
2 detecting the code smell
3 automated refactoring for one smell
4 reapplying step 1
5 analysing the incrementdecrement for each metric value
6 reapplying step 3-5 for each smell
7 identifying the smells whose refactoring better improves the quality of the analysed system
bull We have considered metrics proposed in the literature to measure cohesion coupling and complexity of a system
bull We considered Feature Envy Long Method Shotgun Surgery Large Class
25-03-2011 An experience report on using code smells
detection tools
References
bull [1] F Arcelli M Zanoni ACaracciolo A benchmark platform for design patterns detection Procceedings of the PATTERNS 2010 Conference Lisboa Portugal November 2010
bull [2] F Arcelli M Zanoni A Tool for Design Pattern Detection and Software Architecture Reconstruction Information Sciences Elsevier doi101016jins2010
bull [3] CS-CheckStyle httpcheckstylesourceforgenetindexhtml
bull [4] Martin Fowler Refactoring Improving the Design of Existing Code Addison-Wesley Inc Boston MA USA 1999
bull [5] Hamza H Counsell S Hall T and Loizou G Code smell eradication and associated refactoring 2nd European Computing Conference 2008
bull [6] YGil I Maman Micro Patterns in Java Code Proc of the 20th annual ACM SIGPLAN conference OOPSLA 2005 October 2005
bull [7] M Lanza and R Marinescu Object-Oriented Metrics in Practice Springer-Verlag 2006
bull [8] InCode httpwwwintooituscominCodehtml
bull [9] InFusion httpwwwintooituscominFusionhtml
bull [10] iPlasma httplooseuptroiplasmaindexhtml
bull [11] Mika V Maumlntylauml Jari Vanhanen and Casper Lassenius Bad smells ndash humans as code critics Proc IEEE International Conference on Software Maintenance 0399ndash408 2004
bull [12] T Mens T Tourweacute A Survey of Software Refactoring IEEE Transactions on Software Engineering vol 30 no 2 2004
25-03-2011 An experience report on using code smells
detection tools
References
bull [13] Naouel MohaYann-Gael Gueheneuc Laurence Duchien Anne-Francoise Le Meur Decor a method for the specificatio and detection of code and design smells TSE IEEE CS Press 2010
bull [14] Naouel Moha Yann-Gael Guacuteehacuteeneuc Anne-Francoise Le MeurLaurence Duchien and Alban Tiberghien From a domain analysis to the specification and detection of code and design smells Formal Aspects of Computng 2009
bull [15] Emerson Murphy-Hill Chris Parnin and Andrew P Blac How we refactor and how we know it In ICSE rsquo09 Proceedings of the 31st International Conference on Software Engineering 2009
bull [16] Emerson Murphy-Hill and Andrew P Black An interactive ambient visualization for code smells Proceedings of SOFTVIS 10 USA October 2010
bull [17] C Marinescu R Marinescu P Mihancea D Ratiu and R Wettel iplasma An integrated platform for quality assessment of object-oriented design In Proceedings of 21st International Conference on Software Maintenance (ICSM 2005) Tools Section 2005
bull [18] Steffen Olbrich Daniela Cruzes Victor Basili Nico Zazworka CodeVizardA tool to aid the analysis of software evolution Proceedings ICSE 2010 South Africa
bull [19] PMD httppmdsourceforgenet
bull [20] httpesserediscounimibitreverseCodeSmells html
bull [21] Nikolaos Tsantalis Theodoros Chaikalis and Alexander Chatzigeorgiou JDeodorant Identification and removal of type-checking bad smells In Proceedings of CSMR 2008 pp 329ndash331
bull
25-03-2011 An experience report on using code smells
detection tools
References
bull [1] F Arcelli M Zanoni ACaracciolo A benchmark platform for design patterns detection Procceedings of the PATTERNS 2010 Conference Lisboa Portugal November 2010
bull [2] F Arcelli M Zanoni A Tool for Design Pattern Detection and Software Architecture Reconstruction Information Sciences Elsevier doi101016jins2010
bull [3] CS-CheckStyle httpcheckstylesourceforgenetindexhtml
bull [4] Martin Fowler Refactoring Improving the Design of Existing Code Addison-Wesley Inc Boston MA USA 1999
bull [5] Hamza H Counsell S Hall T and Loizou G Code smell eradication and associated refactoring 2nd European Computing Conference 2008
bull [6] YGil I Maman Micro Patterns in Java Code Proc of the 20th annual ACM SIGPLAN conference OOPSLA 2005 October 2005
bull [7] M Lanza and R Marinescu Object-Oriented Metrics in Practice Springer-Verlag 2006
bull [8] InCode httpwwwintooituscominCodehtml
bull [9] InFusion httpwwwintooituscominFusionhtml
bull [10] iPlasma httplooseuptroiplasmaindexhtml
bull [11] Mika V Maumlntylauml Jari Vanhanen and Casper Lassenius Bad smells ndash humans as code critics Proc IEEE International Conference on Software Maintenance 0399ndash408 2004
bull [12] T Mens T Tourweacute A Survey of Software Refactoring IEEE Transactions on Software Engineering vol 30 no 2 2004
25-03-2011 An experience report on using code smells
detection tools
References
bull [13] Naouel MohaYann-Gael Gueheneuc Laurence Duchien Anne-Francoise Le Meur Decor a method for the specificatio and detection of code and design smells TSE IEEE CS Press 2010
bull [14] Naouel Moha Yann-Gael Guacuteehacuteeneuc Anne-Francoise Le MeurLaurence Duchien and Alban Tiberghien From a domain analysis to the specification and detection of code and design smells Formal Aspects of Computng 2009
bull [15] Emerson Murphy-Hill Chris Parnin and Andrew P Blac How we refactor and how we know it In ICSE rsquo09 Proceedings of the 31st International Conference on Software Engineering 2009
bull [16] Emerson Murphy-Hill and Andrew P Black An interactive ambient visualization for code smells Proceedings of SOFTVIS 10 USA October 2010
bull [17] C Marinescu R Marinescu P Mihancea D Ratiu and R Wettel iplasma An integrated platform for quality assessment of object-oriented design In Proceedings of 21st International Conference on Software Maintenance (ICSM 2005) Tools Section 2005
bull [18] Steffen Olbrich Daniela Cruzes Victor Basili Nico Zazworka CodeVizardA tool to aid the analysis of software evolution Proceedings ICSE 2010 South Africa
bull [19] PMD httppmdsourceforgenet
bull [20] httpesserediscounimibitreverseCodeSmells html
bull [21] Nikolaos Tsantalis Theodoros Chaikalis and Alexander Chatzigeorgiou JDeodorant Identification and removal of type-checking bad smells In Proceedings of CSMR 2008 pp 329ndash331
bull
25-03-2011 An experience report on using code smells
detection tools
References
bull [13] Naouel MohaYann-Gael Gueheneuc Laurence Duchien Anne-Francoise Le Meur Decor a method for the specificatio and detection of code and design smells TSE IEEE CS Press 2010
bull [14] Naouel Moha Yann-Gael Guacuteehacuteeneuc Anne-Francoise Le MeurLaurence Duchien and Alban Tiberghien From a domain analysis to the specification and detection of code and design smells Formal Aspects of Computng 2009
bull [15] Emerson Murphy-Hill Chris Parnin and Andrew P Blac How we refactor and how we know it In ICSE rsquo09 Proceedings of the 31st International Conference on Software Engineering 2009
bull [16] Emerson Murphy-Hill and Andrew P Black An interactive ambient visualization for code smells Proceedings of SOFTVIS 10 USA October 2010
bull [17] C Marinescu R Marinescu P Mihancea D Ratiu and R Wettel iplasma An integrated platform for quality assessment of object-oriented design In Proceedings of 21st International Conference on Software Maintenance (ICSM 2005) Tools Section 2005
bull [18] Steffen Olbrich Daniela Cruzes Victor Basili Nico Zazworka CodeVizardA tool to aid the analysis of software evolution Proceedings ICSE 2010 South Africa
bull [19] PMD httppmdsourceforgenet
bull [20] httpesserediscounimibitreverseCodeSmells html
bull [21] Nikolaos Tsantalis Theodoros Chaikalis and Alexander Chatzigeorgiou JDeodorant Identification and removal of type-checking bad smells In Proceedings of CSMR 2008 pp 329ndash331
bull
25-03-2011 An experience report on using code smells
detection tools