A Catalogue of Code Smell Visualizations
-
Upload
chris-parnin -
Category
Technology
-
view
1.188 -
download
3
description
Transcript of A Catalogue of Code Smell Visualizations
![Page 1: A Catalogue of Code Smell Visualizations](https://reader033.fdocuments.us/reader033/viewer/2022051513/54795455b4af9f495e8b459b/html5/thumbnails/1.jpg)
A A CatalogueCatalogue of of Lightweight Lightweight
Visualizations to Support Visualizations to Support Code SmellCode Smell Inspection Inspection
Chris Chris ParninParnin
Carsten Carsten GörgGörg
Ogechi Ogechi NnadiNnadi
Georgia Institute of Technology
![Page 2: A Catalogue of Code Smell Visualizations](https://reader033.fdocuments.us/reader033/viewer/2022051513/54795455b4af9f495e8b459b/html5/thumbnails/2.jpg)
Practice and Previous WorkPractice and Previous Work
Defect Reports ToolsDefect Reports Tools► ImprecisionImprecision► Many Many Defects Defects
WarningsWarnings
Visualization ToolsVisualization Tools► ““Root-canal” Root-canal”
RefactoringRefactoring
► Built for overviewsBuilt for overviews
Peer ReviewsPeer Reviews► 1- 4 hours 1- 4 hours
preparationpreparation►Monthly frequencyMonthly frequency
““Floss” RefactoringFloss” Refactoring► Refactoring every Refactoring every
week.week.►Mixed with codingMixed with coding
GOALGOAL
Provide support for visualizing code smells in better Provide support for visualizing code smells in better alignment with peer reviews and coding practice.alignment with peer reviews and coding practice.
![Page 3: A Catalogue of Code Smell Visualizations](https://reader033.fdocuments.us/reader033/viewer/2022051513/54795455b4af9f495e8b459b/html5/thumbnails/3.jpg)
A Code SmellA Code Smell
![Page 4: A Catalogue of Code Smell Visualizations](https://reader033.fdocuments.us/reader033/viewer/2022051513/54795455b4af9f495e8b459b/html5/thumbnails/4.jpg)
Defect ReportsDefect Reports
![Page 5: A Catalogue of Code Smell Visualizations](https://reader033.fdocuments.us/reader033/viewer/2022051513/54795455b4af9f495e8b459b/html5/thumbnails/5.jpg)
Automated Tool Case StudyAutomated Tool Case Study
►Examined defects produced by Examined defects produced by GendarmeGendarme tool on industrial project. tool on industrial project.
►Results using Results using 105105 rules: rules: Defects: Defects: 50385038 Over Half from Code Smells:Over Half from Code Smells:
►Duplicated Code: Duplicated Code: 20312031►Large Class: Large Class: 157 157 // 697697►Long Method: Long Method: 8888
![Page 6: A Catalogue of Code Smell Visualizations](https://reader033.fdocuments.us/reader033/viewer/2022051513/54795455b4af9f495e8b459b/html5/thumbnails/6.jpg)
War and PeaceWar and Peace
![Page 7: A Catalogue of Code Smell Visualizations](https://reader033.fdocuments.us/reader033/viewer/2022051513/54795455b4af9f495e8b459b/html5/thumbnails/7.jpg)
Defect Warnings: Now and Defect Warnings: Now and Future.Future.
Improved precision?Improved precision?
►More results will emerge:More results will emerge: New rules (+ 55)New rules (+ 55) Security and concurrencySecurity and concurrency More softwareMore software
![Page 8: A Catalogue of Code Smell Visualizations](https://reader033.fdocuments.us/reader033/viewer/2022051513/54795455b4af9f495e8b459b/html5/thumbnails/8.jpg)
Visualizing Defect Warnings and Visualizing Defect Warnings and Code Smells?Code Smells?
![Page 9: A Catalogue of Code Smell Visualizations](https://reader033.fdocuments.us/reader033/viewer/2022051513/54795455b4af9f495e8b459b/html5/thumbnails/9.jpg)
Treemap of Large Class Code Treemap of Large Class Code SmellsSmells
![Page 10: A Catalogue of Code Smell Visualizations](https://reader033.fdocuments.us/reader033/viewer/2022051513/54795455b4af9f495e8b459b/html5/thumbnails/10.jpg)
How to show just one defect How to show just one defect warning?warning?
►Why?Why? Educational and documentationEducational and documentation ImprecisionImprecision ““Floss” Refactoring vs “Root-Canal” Floss” Refactoring vs “Root-Canal”
Refactoring.Refactoring.
►Challenge:Challenge: Can context be replicated in small form-Can context be replicated in small form-
factor?factor?
![Page 11: A Catalogue of Code Smell Visualizations](https://reader033.fdocuments.us/reader033/viewer/2022051513/54795455b4af9f495e8b459b/html5/thumbnails/11.jpg)
Catalogue of Code Smell Catalogue of Code Smell Visualizations.Visualizations.
SymbolSymbolElemenElementt
methomethoddvariablvariablee
classclassClass with members
and methods
Defect Warning Customer
Foreign classes:
![Page 12: A Catalogue of Code Smell Visualizations](https://reader033.fdocuments.us/reader033/viewer/2022051513/54795455b4af9f495e8b459b/html5/thumbnails/12.jpg)
Spread/FrequencySpread/Frequency
►SpreadSpread – the extent a problem is – the extent a problem is distributed through a code.distributed through a code.
►FrequencyFrequency – the occurrence of same – the occurrence of same instance of a problem.instance of a problem.
switch(code) (60){ }
Occurs in: switch(code) (37){ }
Occurs in:
vs.
![Page 13: A Catalogue of Code Smell Visualizations](https://reader033.fdocuments.us/reader033/viewer/2022051513/54795455b4af9f495e8b459b/html5/thumbnails/13.jpg)
Code Smell CategoriesCode Smell Categories
►Statement-level smellsStatement-level smells
Message Chain
►Method-level smellsMethod-level smells
Long Parameter
![Page 14: A Catalogue of Code Smell Visualizations](https://reader033.fdocuments.us/reader033/viewer/2022051513/54795455b4af9f495e8b459b/html5/thumbnails/14.jpg)
Code Smell Categories (Cont)Code Smell Categories (Cont)
►Class-level smellsClass-level smells
Large Class
►Coordinating classes-level smellsCoordinating classes-level smells
Feature Envy
![Page 15: A Catalogue of Code Smell Visualizations](https://reader033.fdocuments.us/reader033/viewer/2022051513/54795455b4af9f495e8b459b/html5/thumbnails/15.jpg)
Good and BadGood and Bad
Refused Bequest
Data Class
![Page 16: A Catalogue of Code Smell Visualizations](https://reader033.fdocuments.us/reader033/viewer/2022051513/54795455b4af9f495e8b459b/html5/thumbnails/16.jpg)
Classes seen with Classes seen with Large ClassLarge Class ViewView
![Page 17: A Catalogue of Code Smell Visualizations](https://reader033.fdocuments.us/reader033/viewer/2022051513/54795455b4af9f495e8b459b/html5/thumbnails/17.jpg)
Methods with Methods with Long ParameterLong Parameter ViewView
![Page 18: A Catalogue of Code Smell Visualizations](https://reader033.fdocuments.us/reader033/viewer/2022051513/54795455b4af9f495e8b459b/html5/thumbnails/18.jpg)
Classes with Classes with Refused BequestRefused Bequest viewview
![Page 19: A Catalogue of Code Smell Visualizations](https://reader033.fdocuments.us/reader033/viewer/2022051513/54795455b4af9f495e8b459b/html5/thumbnails/19.jpg)
Application SpaceApplication Space
Peer ReviewTool
Continuous TestingNotification Tool
Ambient UnfoldingVisualization
Tool
![Page 20: A Catalogue of Code Smell Visualizations](https://reader033.fdocuments.us/reader033/viewer/2022051513/54795455b4af9f495e8b459b/html5/thumbnails/20.jpg)
Health ScreenHealth Screen
![Page 21: A Catalogue of Code Smell Visualizations](https://reader033.fdocuments.us/reader033/viewer/2022051513/54795455b4af9f495e8b459b/html5/thumbnails/21.jpg)
A Peer Review ToolA Peer Review Tool
►Byte-code scanner with Visual Studio Byte-code scanner with Visual Studio Plugin.Plugin. 12 Smells12 Smells
►WorkflowWorkflow ChecklistChecklist SortingSorting Stacking (Grouping)Stacking (Grouping) Save then InvestigateSave then Investigate
![Page 22: A Catalogue of Code Smell Visualizations](https://reader033.fdocuments.us/reader033/viewer/2022051513/54795455b4af9f495e8b459b/html5/thumbnails/22.jpg)
EvaluationEvaluation
► Systems under Test.Systems under Test. ZedGraph, CruiseControl.NETZedGraph, CruiseControl.NET 3 industrial projects.3 industrial projects.
►Questions:Questions: FeasibilityFeasibility
►Does the contents fit?Does the contents fit?►Can names be shown in a view?Can names be shown in a view?
ScalabilityScalability►How many fit on screen?How many fit on screen?►How many screens?How many screens?
![Page 23: A Catalogue of Code Smell Visualizations](https://reader033.fdocuments.us/reader033/viewer/2022051513/54795455b4af9f495e8b459b/html5/thumbnails/23.jpg)
Views Overflowed BoundsViews Overflowed Bounds
Smell Overflow
Middle Man 1
Message Chain 0
Data Class 7 / 26
Long Parameter 0
Refused Bequest 10
Feature Envy *
Large Class 1
![Page 24: A Catalogue of Code Smell Visualizations](https://reader033.fdocuments.us/reader033/viewer/2022051513/54795455b4af9f495e8b459b/html5/thumbnails/24.jpg)
Addressing Overflow.Addressing Overflow.
Large Class
Data Class
Feature Envy
![Page 25: A Catalogue of Code Smell Visualizations](https://reader033.fdocuments.us/reader033/viewer/2022051513/54795455b4af9f495e8b459b/html5/thumbnails/25.jpg)
DiscussionDiscussion
► Informal evaluation: Informal evaluation: Peer ReviewPeer Review Developer trials Developer trials [Help explaining smells][Help explaining smells] Classroom lectures.Classroom lectures.
►UnevaluatedUnevaluated Symbol comprehension.Symbol comprehension. Balancing choices.Balancing choices. Further Interaction requirements.Further Interaction requirements.
![Page 26: A Catalogue of Code Smell Visualizations](https://reader033.fdocuments.us/reader033/viewer/2022051513/54795455b4af9f495e8b459b/html5/thumbnails/26.jpg)
ConclusionConclusion
►A new opportunity for source visualization A new opportunity for source visualization research: research: Defect Warnings VisualizationDefect Warnings Visualization.. What other defects warnings can be visualized?What other defects warnings can be visualized?
►Small-factor, portable visualizations:Small-factor, portable visualizations: Notification, Report embeddable.Notification, Report embeddable.
►Other Information Snippet Visualizations?Other Information Snippet Visualizations?
![Page 27: A Catalogue of Code Smell Visualizations](https://reader033.fdocuments.us/reader033/viewer/2022051513/54795455b4af9f495e8b459b/html5/thumbnails/27.jpg)
Stack by ClassStack by Class
![Page 28: A Catalogue of Code Smell Visualizations](https://reader033.fdocuments.us/reader033/viewer/2022051513/54795455b4af9f495e8b459b/html5/thumbnails/28.jpg)
Advanced InteractionsAdvanced Interactions
►Gathering and Scattering.Gathering and Scattering.►Stacking Stacking
(Stack information)(Stack information) 3d stack.3d stack.
►Deep zoom.Deep zoom.
![Page 29: A Catalogue of Code Smell Visualizations](https://reader033.fdocuments.us/reader033/viewer/2022051513/54795455b4af9f495e8b459b/html5/thumbnails/29.jpg)
switch(code) (37){ }