selected topics of software technology 3 code smells topics of software technology 3 2 code smells...
TRANSCRIPT
Selected Topics of Software Technology 3 Code Smells 1
S C I E N C E P A S S I O N T E C H N O L O G Y
www.tugraz.at
Selected Topics of Software Technology 3 Code Smells
Birgit Hofer Institute for Software Technology
Selected Topics of Software Technology 3 Code Smells 2
Outline
Motivation − Video about Spreadsheet disasters
Code Smells in Software − What smells? − Tools
Code Smells in Spreadsheets − What smells? − Tools
Selected Topics of Software Technology 3 Code Smells 3
Outline
Motivation − Video about Spreadsheet disasters
Code Smells in Software − What smells? − Tools
Code Smells in Spreadsheets − What smells? − Tools
Selected Topics of Software Technology 3 Code Smells 4
Spreadsheets The Ununderstood Dark Matter of IT
Felienne Hermans, Delfth University of Technology
Selected Topics of Software Technology 3 Code Smells 5
Number of spreadsheets
Who Estimated Real Investment Bank 10 000 2.5 million
Birgit Hofer 5 000 • xls: 11 034 (76 regular / 10 958 benchmarks)
• xlsx: 2 116 (119 regular / 1 997 benchmarks)
• online: 23
Peter 60 • PC: 136 • Laptop: 16
Thomas ? • xls: 140 • xlsx: 65
Petra 5 000 • xls: 5 547 • xlsx: 836 • online: 1
Christoph ? • xls: 10 • online: 10
Selected Topics of Software Technology 3 Code Smells 6
Outline
Motivation − Video about Spreadsheet disasters
Code Smells in Software − What smells? − Tools
Code Smells in Spreadsheets − What smells? − Tools
Selected Topics of Software Technology 3 Code Smells 7
What are Code Smells?
Any symptom in the source code of a program that possibly indicates a deeper problem. Not bugs, but they increase the risk
of introducing bugs. Indicate the need of refactoring.
Static Code Analysis
Selected Topics of Software Technology 3 Code Smells 8
Code Smells in Software Code Smells within Classes − Coding standard − Long methods − Long parameter list − Duplicated code − Large classes − Dead code
Code Smells between Classes − Inappropriate Intimacy − Data clumps − Indecent Exposure − Feature Envy − Message Chains
Selected Topics of Software Technology 3 Code Smells 9
Tools for Detecting Code Smells
Java − Checkstyle − FindBugs − PMD
C/C++ − Lint
.Net − CodeIt.Right
Selected Topics of Software Technology 3 Code Smells 10
Outline
Motivation − Video about Spreadsheet disasters
Code Smells in Software − What smells? − Tools
Code Smells in Spreadsheets − What smells? − Tools
Selected Topics of Software Technology 3 Code Smells 11
Relevant Literature Hermans, Pinzger and van Deursen:
“Detecting Code Smells in Spreadsheet Formulas”, Int. Conference on Software Maintenance (ICSM) 2012.
Hermans, Pinzger and van Deursen: “Detecting and visualizing inter-worksheet smells in spreadsheets”, Int. Conference on Software Engineering (ICSE) 2012.
Kulesz and Ostberg: “Practical Challenges with Spreadsheet Auditing Tools”, European Spreadsheet Risks Interest Group Conf. (EuSpRIG), 2013.
Cunha, Fernandes, Ribeiro and Saraiva: “Towards a Catalog of Spreadsheet Smells”, Int. Conf. on Computational Science and Its Applications (ICCSA), 2012.
Cunha, Fernandes, Martins, Mendes and Saraiva: “SmellSheet detective: A tool for detecting bad smells in spreadsheets”, Symp. on Visual Languages and Human-Centric Computing (VL/HCC) 2012
Selected Topics of Software Technology 3 Code Smells 12
Formula Smells
Multiple Operations
Multiple References
Conditional Complexity
Long Calculation Chains
Duplicated Formulas
Source: Hermans, Pinzger and van Deursen: “Detecting Code Smells in Spreadsheet Formulas”, Int. Conference on Software Maintenance (ICSM) 2012.
Selected Topics of Software Technology 3 Code Smells 13
Inter-worksheet Smells
Inappropriate Intimacy
Feature Envy
Middle Man
Shotgun Surgery
Source: Hermans, Pinzger and van Deursen: “Detecting and visualizing inter-worksheet smells in spreadsheets”, Int. Conference on Software Engineering (ICSE) 2012.
Selected Topics of Software Technology 3 Code Smells 14
Other Code Smell for Spreadsheets Statistical smells o Standard deviation
Type smells o Empty cell o Pattern finder
Content smell o String distance o Reference to empty cells
Functional dependencies based smells o Quasi-Functional Dependencies (QFD)
Source: Cunha, Fernandes, Ribeiro and Saraiva: “Towards a Catalog of Spreadsheet Smells”, Int. Conf. on Computational Science and Its Applications (ICCSA), 2012.
Selected Topics of Software Technology 3 Code Smells 15
Code Smells Examples
Standard deviation Pattern finder
Empty cell QFD
String distance
Selected Topics of Software Technology 3 Code Smells 16
Standard Deviation – How to identify data outliers?
Conditional formatting
Selected Topics of Software Technology 3 Code Smells 17
Empty Cell Smell – How to identify?
Selected Topics of Software Technology 3 Code Smells 18
Empty Cell Smell – How to identify?
Selected Topics of Software Technology 3 Code Smells 19
Empty Cell Smell – How to identify?
Selected Topics of Software Technology 3 Code Smells 20
Empty Cell Smell – How to identify?
Empty cell
Selected Topics of Software Technology 3 Code Smells 21
Tools for Detecting Code Smells
SIF (Spreadsheet Inspection Framework) − https://github.com/kuleszdl/Spreadsheet-Inspection-Framework
SmellSheet Detective and FaultySheet Detective − http://ssaapp.di.uminho.pt/twiki/bin/view/Main/Software
Breviz − Tool developed at TU Delfth, download?
Selected Topics of Software Technology 3 Code Smells 22
Some remarks
Determining thresholds could be difficult
Handling of false positives Time-consuming and boring
Configuration Adjustable
Challenge:
How to convince users of “higher quality” related issues like maintenance?
Selected Topics of Software Technology 3 Code Smells 23
Some remarks – Output representation
Flat list of findings Links missing (navigation) Lists ordered after severity or grouped by type
Separate file Links missing Cell coloring and comments added Take care with spreadsheets that rely on conditional formatting Not too many colors, use intuitive colors
Critical smell Non-critical smell
Selected Topics of Software Technology 3 Code Smells 24
Outline
Motivation − Video about Spreadsheet disasters
Code Smells in Software − What smells? − Tools
Code Smells in Spreadsheets − What smells? − Tools