a catalogue of code smell visualizations

29
Lightweight Lightweight Visualizations to Visualizations to Support Support Code Smell Code Smell Inspection Inspection Chris Chris Parnin Parnin Carsten Carsten Görg Görg Ogechi Ogechi Nnadi Nnadi Georgia Institute of Technology

Upload: chris-parnin

Post on 29-Nov-2014

1.189 views

Category:

Technology


3 download

DESCRIPTION

Discussion of code smell visualizations, code reviews, and why most vis aren't solving the right problem.

TRANSCRIPT

Page 1: A Catalogue of Code Smell Visualizations

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

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

A Code SmellA Code Smell

Page 4: A Catalogue of Code Smell Visualizations

Defect ReportsDefect Reports

Page 5: A Catalogue of Code Smell Visualizations

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

War and PeaceWar and Peace

Page 7: A Catalogue of Code Smell Visualizations

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

Visualizing Defect Warnings and Visualizing Defect Warnings and Code Smells?Code Smells?

Page 9: A Catalogue of Code Smell Visualizations

Treemap of Large Class Code Treemap of Large Class Code SmellsSmells

Page 10: A Catalogue of Code Smell Visualizations

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

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

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

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

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

Good and BadGood and Bad

Refused Bequest

Data Class

Page 16: A Catalogue of Code Smell Visualizations

Classes seen with Classes seen with Large ClassLarge Class ViewView

Page 17: A Catalogue of Code Smell Visualizations

Methods with Methods with Long ParameterLong Parameter ViewView

Page 18: A Catalogue of Code Smell Visualizations

Classes with Classes with Refused BequestRefused Bequest viewview

Page 19: A Catalogue of Code Smell Visualizations

Application SpaceApplication Space

Peer ReviewTool

Continuous TestingNotification Tool

Ambient UnfoldingVisualization

Tool

Page 20: A Catalogue of Code Smell Visualizations

Health ScreenHealth Screen

Page 21: A Catalogue of Code Smell Visualizations

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

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

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

Addressing Overflow.Addressing Overflow.

Large Class

Data Class

Feature Envy

Page 25: A Catalogue of Code Smell Visualizations

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

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

Stack by ClassStack by Class

Page 28: A Catalogue of Code Smell Visualizations

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

switch(code) (37){ }