Upload
chris-parnin
View
1.189
Download
3
Tags:
Embed Size (px)
DESCRIPTION
Discussion of code smell visualizations, code reviews, and why most vis aren't solving the right problem.
Citation preview
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
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.
A Code SmellA Code Smell
Defect ReportsDefect Reports
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
War and PeaceWar and Peace
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
Visualizing Defect Warnings and Visualizing Defect Warnings and Code Smells?Code Smells?
Treemap of Large Class Code Treemap of Large Class Code SmellsSmells
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?
Catalogue of Code Smell Catalogue of Code Smell Visualizations.Visualizations.
SymbolSymbolElemenElementt
methomethoddvariablvariablee
classclassClass with members
and methods
Defect Warning Customer
Foreign classes:
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.
Code Smell CategoriesCode Smell Categories
►Statement-level smellsStatement-level smells
Message Chain
►Method-level smellsMethod-level smells
Long Parameter
Code Smell Categories (Cont)Code Smell Categories (Cont)
►Class-level smellsClass-level smells
Large Class
►Coordinating classes-level smellsCoordinating classes-level smells
Feature Envy
Good and BadGood and Bad
Refused Bequest
Data Class
Classes seen with Classes seen with Large ClassLarge Class ViewView
Methods with Methods with Long ParameterLong Parameter ViewView
Classes with Classes with Refused BequestRefused Bequest viewview
Application SpaceApplication Space
Peer ReviewTool
Continuous TestingNotification Tool
Ambient UnfoldingVisualization
Tool
Health ScreenHealth Screen
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
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?
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
Addressing Overflow.Addressing Overflow.
Large Class
Data Class
Feature Envy
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.
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?
Stack by ClassStack by Class
Advanced InteractionsAdvanced Interactions
►Gathering and Scattering.Gathering and Scattering.►Stacking Stacking
(Stack information)(Stack information) 3d stack.3d stack.
►Deep zoom.Deep zoom.
switch(code) (37){ }