FUTURE CHALLENGES IN SOFTWARE EVOLUTION AND QUALITY ANALYSIS FROM INDUSTRIAL & ACADEMIC PERSPECTIVES Aiko Yamashita, PhD.
Centrum Wiskunde & Informatica, Netherlands Oslo and Akershus University College of Applied Sciences, Norway 2016-12-01
FUTURE CHALLENGES IN SOFTWARE EVOLUTION AND QUALITY ANALYSIS FROM - - PowerPoint PPT Presentation
FUTURE CHALLENGES IN SOFTWARE EVOLUTION AND QUALITY ANALYSIS FROM INDUSTRIAL & ACADEMIC PERSPECTIVES Aiko Yamashita, PhD. Centrum Wiskunde & Informatica, Netherlands Oslo and Akershus University College of Applied Sciences, Norway
Centrum Wiskunde & Informatica, Netherlands Oslo and Akershus University College of Applied Sciences, Norway 2016-12-01
Sapporo, Japan San Francisco, USA mom dad Oslo, Norway San Jose, Costa Rica Gothenburg, Sweden Berkeley, USA
Amsterdam, Netherlands
**product-related and project-related (empirical) metrics
Heuristics
90
50
8
Design restructuring Heuristics for programmers Evaluation/ estimation
00101001 11011011 00010110 00101001
Unstructured data Reports Code/Design attributes Historical data
(refactoring, rework) and a risk (introduction defects).
performs best, and which are the preconditions (e.g., additional data) required.
Developer System
Task 3. New Reporting functionality Task 1. Replacing external data source
Task 2. New authentication mechanism
System System!
System Project context Tasks
Source code Daily interviews Audio files/notes Subversion database
Programming Skill
Defects*
Development Technology
Change Size** Effort** Maintenance outcomes
Think aloud Video files/notes Task progress sheets Eclipse activity logs Trac (Issue tracker), Acceptance test reports Open interviews Audio files/notes
Variables
Data sources Moderator variables
Code smells
(num. smells** smell density**) ** System and fle level * Only at system level Maintainability perception* Maintenance problems**
Think aloud Video files/notes Study diary
fact-sheet
Interconnected
Systems were ranked according to their no. of code smells, and their smell density (no. smells/KLOC). Maintainability Assessment Systems were ranked a c c o r d i n g t o t h e i r maintainability, which was measured by: effort (time) and defects introduced. Actual Maintainability
Do they correspomd?
Standardized scores were calculated for the ranking
Number of code smells displayed highest correspondence to actual maintainability
Number of code smells is correlated with system size!
Developer Audio fjle Transcript Coded Statement System Maintainability Factor Cross-case Matrix
Appropriate technical platform Coherent naming Design suited to the problem domain Initial defects Architecture
Not covered
Encapsulation Inheritance Libraries Simplicity Use of components Design consistency Logic Spread
Partially covered
Duplicated code
Covered
Interconnected
Dependent variable: Problematic? Independent variables: 12 smells Control variables:
Analysis: Logistic Regression Model Explanatory model for Problem Dependent variable: Effort (time) Independent variables: 12 smells Control variables:
Analysis: Multiple Regression Model Explanatory model for Effort
(ISPV) was able to explain problems [Exp(B) = 7.610, p = 0.032]
model [Exp(B) = 0.053, p = 0.029] but associated to less problems!
be associated to code smells that are related to size.
related to error/change propagation, and difficult concept location. Explanatory model for Problem Explanatory model for Effort
number of changes and code smells displayed a fit of R2 = 0.58
did not decrease the fit!! (R2 = 0.58)
was Refused Bequest, which registered a decrease in effort (α < 0.01)
the most significant predictors of effort (α < 0.001) Code smells are not better at explaining sheer-effort at file level, than size and number of revisions. Some code smells can potentially explain the occurrence of problems during maintenance. Also, not all smells seem to be problematic…
Interconnected
Principal Component Analysis Dependency Analysis
% Non-Source code related difficulties % Source code related difficulties % Code-smell related difficulties % Non-code-smell related difficulties Maintenance Difficulties ¡Observa)onal ¡study ¡Daily ¡interviews ¡Think-‑aloud ¡protocol
Distribution of maintenance problems according to source
Some patterns where identified..
Hoarders Feature Envy God Class God Method Data Containers Data Clump Data Class Wide Interfaces ISP Violation Shotgun Surgery Confounders Temporal variable used for several purposes Duplicated code in conditional brances have dependencies
could become are often found together with could become
File System DC CL DUP FE GC GM ISPV MC RB SS Temp Imp StudyDatabase A 7 1 1 1 1 1 PrivilegesManageAction B 1 1 StudiesEditAction B 1 2 StudiesSearchAction B 1 1 1 StudySearch B 2 1 2 DB C 2 16 1 2 1 1 StudyDAO D 1 10 1 2 1 1 1
P r
l e m a t i c fi l e s w i t h a t l e a s t
e G
M e t h
: Hoarders in System B and how they are distributed across two co
File Individual code smells Coupled smells StudySearch.java GC, GM, FE ObjectStatementImpl.java ISPV, SS FE, GM, ISPV, GC, SS MemoryCachingSimula.java GC, TMP Simula.java ISPV, SS ISPV, GC, SS, TMP
S y s t e m B
God Class Feature Envy God Class Feature Envy
Coupling
A B
Coupled smells can have similar implications as collocated smells!
Typed getters and setters
Open Source Systems Name: ElasticSearch Java: 2951 files Total Size: 253 KLOC History: 102 minor releases and 22 major releases since 2010 S e a r c h e n g i n e p l a t f
m Name: Mahout Java: 935 Scala: 12 Total Size: 92 KLOC History: 10 releases since 2010 M a c h i n e l e a r n i n g l i b r a r y Industrial System Name: Ebehandling Java: 5300 files Total: 5840 files Total Size: 601 KLOC History: 40 major releases and 15 patch releases since 2009 G r a n t a p p l i c a t i
s y s t e m
Principal Component Analysis Dependency Analysis
System (Component) Smells Ebehandling (9) Mahout (10) ElasticSearch (8) Data Class Feature Envy Ebehandling (7) ElasticSearch (14) Sibling Duplication Message Chains Mahout (5) ElasticSearch (1) God Class Schizo Class Ebehandling (1) Mahout (5) God Class Data Class Message Chains Mahout (9) ElasticSearch (7) God Class Feature Envy Ebehandling (4) ElasticSearch (13) Feature Envy Message Chains Ebehandling (5) Mahout (2) Internal Duplication External Duplication
Pattern 3
Sibling Duplication Message Chains Ebehandling (7), ElasticSearch(14) Message Chains Sibling Duplication Class Ebehandling (2), ElasticSearch(3)
Pattern 1
Feature Envy Data Class Ebehandling (9), Mahout(10) Class Data Class Feature Envy ElasticSearch (8)
Pattern 5
Class God Class Feature Envy Ebehandling (1), ElasticSearch(1)
GodClass ExternalDuplication FeatureEnvy 1 3 GodClass FeatureEnvy IntensiveCoupling 2 4 GodClass FeatureEnvy IntensiveCoupling 1 4
InternalDuplication ExternalDuplication 1 3
Pattern 7
Mahout(2) Class Internal Duplication External Duplication External Duplication Internal Duplication Class Ebehandling (6)
(a) (b) (c)
Data Clumps having dependencies
Mahout Ebehandling ElasticSearch
P a t t e r n 9
Data Clumps Data Clumps Ebehandling (8), Mahout(6), ElasticSearch(5) ion God Class Feature Envy Ebehandling (1), ElasticSearch(1)
(a) (c) (b)
Classes having incomming dependencies from God Classes and Feature Envy methods Ebehandling Mahout ElasticSearch
Pattern 9
s Data Clumps ElasticSearch(5) t(5)
Pattern 5
Class God Class Feature Envy Ebehandling (1), ElasticSearch(1)
Programming (code-related) activities during Maintenance Reading Searching Navigating Editing Others
Eclipse activity logs
Activity logs
➡Mostly performed activities:
Navigating (58.72%), Reading (28.27%), Editing (10.18%) and searching (2.47%)
➡Distribution is consistent with Ko
et al. 2006 (top four)
➡Reading as most consuming activity
in Ko et al. 2006.
an activity
For our analysis, we only consider: Editing, Navigating, Searching and Reading
S m e l l s e x p l a i n b e t t e r E d i t i n g a n d N a v i g a t i n g e f f
t t h a n fi l e s i z e , b u t n
f
R e a d i n g a n d S e a r c h i n g Maintenance problems in previous work related to increased effort for editing, navigating and reading
Developer Round Effort (time) System Main variables Refactorings (types, no.)
Is#there#an#individual#refactoring#style? What#are#the#general#tendencies#w.r.t.#refactorings? Is#there#a#learning#when#refactoring?#(diff#between#rounds) Research(ques+ons:
Refactored files and directories
Files and directories before maintenance Files and directories after maintenance
Dataset(1
Code smells (initial) Type of task Associated to bugfix? Code smells (final) Main variables Size in LOC (initial) Total effort Total churn Size in LOC (final) Other variables Original file? Refactored files and directories Java files
Dataset&2 Does%the%ini*al%design**%affect%the%choice%of%refactorings%and%smell%evolu*on? Does%the%type%of%task%affect%the%types/effort%spent%on%refactoring? Research&ques.ons:
Only for developer 3, there was an effect from system, we suspect due to a more “ad-hoc” refactoring strategy
0" 20" 40" 60" 80" 100" 120" 140" Rename"element" Select"refactoring"menu" Change"method"signature" Generate"constructors"using" Generate"constructors"from" Extract"local"variable" Organize"the"imports" Extract"method" Extract"Super"Class" Pull"Up" Override"or"Implement" Rename"informaFon" Infer"generic"type" Generalize"declared"type" Push"Down" Move"method/class" Convert"nested"to"top"acFon" Introduce"Parameter"AcFon" Generate"Delegate"Methods" Extract"Constant" Extract"Interface" 1"A" 2"D" 0" 2" 4" 6" 8" 10" 12" Rename"element" Select"refactoring"menu" Change"method"signature" Generate"constructors"using" Generate"constructors"from" Extract"local"variable" Organize"the"imports" Extract"method" Extract"Super"Class" Pull"Up" Override"or"Implement" Rename"informaFon" Infer"generic"type" Generalize"declared"type" Push"Down" Move"method/class" Convert"nested"to"top"acFon" Introduce"Parameter"AcFon" Generate"Delegate"Methods" Extract"Constant" Extract"Interface" 1"D" 2"C" 0" 1" 2" 3" 4" 5" 6" 7" 8" 9" Rename"element" Select"refactoring"menu" Change"method"signature" Generate"constructors"using" Generate"constructors"from" Extract"local"variable" Organize"the"imports" Extract"method" Extract"Super"Class" Pull"Up" Override"or"Implement" Rename"informaFon" Infer"generic"type" Generalize"declared"type" Push"Down" Move"method/class" Convert"nested"to"top"acFon" Introduce"Parameter"AcFon" Generate"Delegate"Methods" Extract"Constant" Extract"Interface" 1"B" 2"A" 0" 10" 20" 30" 40" 50" 60" Rename"element" Select"refactoring"menu" Change"method"signature" Generate"constructors"using" Generate"constructors"from" Extract"local"variable" Organize"the"imports" Extract"method" Extract"Super"Class" Pull"Up" Override"or"Implement" Rename"informaFon" Infer"generic"type" Generalize"declared"type" Push"Down" Move"method/class" Convert"nested"to"top"acFon" Introduce"Parameter"AcFon" Generate"Delegate"Methods" Extract"Constant" Extract"Interface" 1"C" 2"B" 0" 0.5" 1" 1.5" 2" 2.5" Rename"element" Select"refactoring"menu" Change"method"signature" Generate"constructors"using" Generate"constructors"from" Extract"local"variable" Organize"the"imports" Extract"method" Extract"Super"Class" Pull"Up" Override"or"Implement" Rename"informaFon" Infer"generic"type" Generalize"declared"type" Push"Down" Move"method/class" Convert"nested"to"top"acFon" Introduce"Parameter"AcFon" Generate"Delegate"Methods" Extract"Constant" Extract"Interface" 1"C" 2"D" 0" 0.5" 1" 1.5" 2" 2.5" 3" 3.5" Rename"element" Select"refactoring"menu" Change"method"signature" Generate"constructors"using" Generate"constructors"from" Extract"local"variable" Organize"the"imports" Extract"method" Extract"Super"Class" Pull"Up" Override"or"Implement" Rename"informaFon" Infer"generic"type" Generalize"declared"type" Push"Down" Move"method/class" Convert"nested"to"top"acFon" Introduce"Parameter"AcFon" Generate"Delegate"Methods" Extract"Constant" Extract"Interface" 1"A" 2"B"
developer 1 developer 4 developer 2 developer 3 developer 5 developer 6
Model &2(Log( likelihood Cox(&(Snell(R( Square Nagelkerke(R( Square Variables((contributing Data(Clump!(Beta!=(4,093!p!<!0,05) Data(Class!(Beta!=!5,568!p!<!0,05) Feature(Envy!(Beta!=4,303!p!<!0,05) Shotgun(Surgery!(Beta!=!(3,657!p!<!0,001) Total(no.(smells!(Beta!=!(3,414!p<0,05) Extract!method 256,678 ,103 ,209 Lines(of(code!(Beta!=!0,197!p!<!0,01) ,371 ,081 72,718 Change!method!signature ,149 ,102 473,871 Organize!imports
0" 20" 40" 60" 80" 100" 120" 140" 160" R e n a m e " e l e m e n t " C h a n g e " m e t h
" s i g n a t u r e " G e n e r a t e " c
s t r u c t
s " u s i n g " fi e l d s " G e n e r a t e " c
s t r u c t
s " f r
" s u p e r c l a s s " E x t r a c t " l
a l " v a r i a b l e " O r g a n i z e " t h e " i m p
t s " E x t r a c t " m e t h
" E x t r a c t " S u p e r " C l a s s " P u l l " U p " O v e r r i d e "
" I m p l e m e n t " m e t h
" R e n a m e " i n f
m a G
" I n f e r " g e n e r i c " t y p e " G e n e r a l i z e " d e c l a r e d " t y p e " P u s h " D
n " M
e " m e t h
/ c l a s s " C
v e r t " n e s t e d " t
t
" a c G
" I n t r
u c e " P a r a m e t e r " A c G
" G e n e r a t e " D e l e g a t e " M e t h
s " E x t r a c t " C
s t a n t " E x t r a c t " I n t e r f a c e " Task"1" Task"2" Task"3"
For tasks, it was much more the task size what could explain the frequency, rather than the type of task Only few code smells could explain some refactorings (some with negative coefficients)
Software measurements Human measurements Interaction
Heuristics
Think-aloud sessions
00101001 11011011 00010110 00101001
IDE Logs
evolution, defects and behavioural patterns from developers
Defect data Change history
Process Mining Events Visualization
Theory
Recommender systems
Guide focus
research
Problems experienced Interaction traces
Validation of theoretical models Deviations from normal flow General bottlenecks
search hypothesize execute action validate consolidate
Behavioral Model
Defect data Issues data Change history
Defect data Issues data Change history
Iteration planning
Mini-iteration
Retrospective create use
2 weeks (normal) iteration Continuous process monitoring
update R e f a c t
i n g B a c k l
Iteration planning
2 weeks (normal) iteration
Retrospective
Mini-iteration ...
Detection Effort
Code Smell Effort implement Side-effects Refactoring
*..*
Knowledge base
1.Technology should be available
1.Technology should
g
1.Technology should be available 2 . W h i c h c a n b e t e s t e d i n c a s e s t u d i e s v i a f e a s i b l e r
t i n e s
Iteration planning
Mini-iteration
Retrospective create use
2 weeks (normal) iteration Continuous process monitoring
update Refactoring Backlog Iteration planning
2 weeks (normal) iteration
Retrospective
Mini-iteration ...
Detection Effort
Code Smell Effort implement Side-effects Refactoring
*..*
Knowledge base
( )
CF', 2BGBG0CF' 1F I8FGF CCF%, 49BG937F) 5CC6BCF I8FGF) 0CF7BI7 C7FFB7F%
Where do you read about code smells?
Cross and Hagardon. “Critical Connections: Driving Rapid Innovation with a Network Perspective”
( )
CF', 2BGBG0CF' 1F I8FGF CCF%, 49BG937F) 5CC6BCF I8FGF) 0CF7BI7 C7FFB7F% Yamashita & Moonen, 2013 - “Do Developers Care About Code Smells? – An Exploratory Survey”
Accessibility issues?
“If you don't make it to air, there is
We like low- hanging fruits!
Prejudices on results coming from academia:
“too complicated”‘,“too theoretical”, “boring”, “not as cool as..”
Wave of technology adoption may obey a different set of rules than our current understanding... Maybe we need to understand better the phenomenon of adoption from a sociological perspective (e.g., perception)
Now many OSS projects are “sleek”... and why not?
Defect data Issues data
may be a challenge, even if the data is correctly classified)
Defect data Issues data
defect taxonomy
construction modelling/design requirements requirement captured incorrectly requirement not implemented requirement misunderstood while implementing design flaw / code smell / anti-pattern logic incorrect expression data-flow (incl. variable assignment / initialization) algorithm (control-flow) data database OR mapping interface user interaction API (technical interface) resources memory concurrency performance case completeness exceptions validation language environment
OS 3rd Party hardware built environment build tools (make/rake etc) configuration management system QA standards documentation testing
Building a metadata for improvig sampling of projects from GitHub
do I really need to check all
Defect data Issues data Change history
S
t w a r e a r c h e
i s t
C
c e p t h a s b e e n p r
e d b y A l v e s , F e r r e i r a , B a g g e n , O l i v e i r a . . .
R E S T A P I C l
e d a n d a n a l y z e d Percentiles Analysis B e n c h m a r k ( S e t
. c s v fi l e s )
Smell detector
The Tabulating Era (1900s – 1940s) The Cognitive Era (2011 – ) The Programming Era (1950s – present)
Image 1
Source: IBM
Modern Software Engineering Research Empirical Methods Tools, Languages and Methods Real-life, industrial scale validation Study of Human and Social Factors Study of Contextual Factors Theory Hypothesis Data
Analyzer4J
InCode
Software Analysis Software Transformation Software Generation Tools for Software Development Formal Methods Machine Learning Language Engineering
Contact: aiko.fallas@gmail.com