Understanding mobile-specific code smells
Presented by:
Sarra Habchi
Examiners:
- Jean-Christophe Routier
- Naouel Moha
- Tegawendé-François Bissyande
Advisor:
- Romain Rouvoy
Rapporteurs:
- Andy Zaidman
- Yann-Gaël Guéhéneuc
Understanding mobile-specific code smells Presented by: Sarra - - PowerPoint PPT Presentation
Understanding mobile-specific code smells Presented by: Sarra Habchi Advisor: Examiners: - Romain Rouvoy - Jean-Christophe Routier Rapporteurs: - Naouel Moha - Andy Zaidman - Tegawend-Franois Bissyande - Yann-Gal Guhneuc
Presented by:
Sarra Habchi
Examiners:
Advisor:
Rapporteurs:
Raconteur.net 2
3
4
5
6
7
8
9
10
11
12
13
Semi-automated analysis Official documentation Developer blogs & talks Q&A forums Catalog of 30 Android code smells ... performance
14
15
UI Overdraw
1 overdraw 2 overdraws 3 overdraws 4 overdraws
16
17
18
19
20
21
22
23
24
We have: We lack:
Understanding mobile code smells
25
Understanding mobile code smells
26
27
Code Smells in iOS Apps: How do they compare to Android?
28
Understanding mobile code smells
29
Understanding mobile code smells
30
31
Motives of technical debt (Tom et al. 2013)
32
Motives of technical debt (Tom et al. 2013)
33
Motives of technical debt (Tom et al. 2013)
34
35
1- Commits 2- Developers 3- Survival
36
1- Commits 2- Developers 3- Survival
Commit0 Commit1 Commitk Commitn
Code smell introduction Code smell removal
Instance A Instance A Instance B Instance A Instance B Instance A
37
Commit0 Commit1 Commitk Commitn
Instance A Instance A Instance B Instance A Instance B Instance A
38
Commitm Commitp
Instance A Instance A Instance C
39 RegistrationSocket.java GcmSocket.java Commit 303d1ac: File renaming
Instance
RegistrationSocket$Verification
Instance
GcmSocket$Verification
link
40
41
Sniffer
42
Commits Git link to an app 1-Extract app data Repository model Instances 3- Analyse change history 2- Detect code smells Full code smell history
Sniffer
○ F1-score=0.96
43
Dataset
44
45
46
Introductions
47
% Removals
48
49
50
No Low Memory Resolver
51
52
53
54
% Removals by deletion
55
Manual analysis
○ Commit actions ○ Commit message
56
How are code smells removed?
○ Source code deleted ○ Empty methods filled (MIM)
57
How are code smells removed?
○ Code smells detected by Android Lint ■ Init OnDraw (IOD) ■ UI Overdraw (UIO)
58
59
60
Motives of technical debt
61
How do releases impact code smell introductions and removals?
1 Day 1 Week 1 Month
62
63
Releases do not have any impact on code smell introductions or removals.
64
Motives of technical debt
65
1- Commits 2- Developers 3- Survival
66
1- Commits 2- Developers 3- Survival
67
68
69
70
71
72
73
74
Expected
75
Introductions Removals
76
⍴ = 0.77
77
Seniority and code smells
78
“Developers with lots of followers were treated as local
parable”
(Dabbish et al. 2012)
79
⍴ = 0.27 ⍴ = 0.24
80
Senior Junior
→ Seniority does not impact developers’ behavior
Senior Junior
81
82
Motives of technical debt
82
83
1- Commits 2- Developers 3- Survival
84
1- Commits 2- Developers 3- Survival
85
Survival analysis
“Chances for a code smell to be still present in the source code after t time”
86
87
441 days 14 months
88
9 commits
89
Variables: project properties
○ #Classes ○ #Commits ○ #Developers
○ #Releases ○ Cycle
90
Variables: Code smell properties
○ Linted (detectable by Android Lint) ○ Linter priority
○ Granularity
91
Variables: Code smell properties
○ Linted (detectable by Android Lint) ○ Linter priority
○ Granularity
92
93
→ Static analysers have an impact on mobile code smells → Tool prioritisation matters
94
95
Motives of technical debt
95
Understanding mobile code smells
96
Understanding mobile code smells
97
98
Catalog of performance code smells
How do they use the linter to deal with performance concerns?
99
100 100
101 101
102 102
Benefits
103 103
Benefits
104 104
105
105
106
106
107 107
108 108
Challenges
109 109
Challenges
110 110
111
112
112
Challenges
113 113
Challenges
114 114
115
116
116
117
117
Implications for researchers
bad practices in mobile apps
118
Understanding mobile code smells
119
Understanding mobile code smells
120
121 121
122 122
123
Code smell The definition omits The definition leads to No Low Memory Resolver Alternative means to avoid the code smell False positives UI Overdraw HashMap Usage Technical details Leaking Inner Class Prevalent programming fashions Occurrences that are:
Member Ignoring Method Unsupported Hardware Acceleration Absence of alternatives
124
Code smell The definition omits The definition leads to No Low Memory Resolver Alternative means to avoid the code smell False positives UI Overdraw HashMap Usage Technical details Leaking Inner Class Prevalent programming fashions Occurrences that are:
Member Ignoring Method Unsupported Hardware Acceleration Absence of alternatives
125
Code smell The definition omits The definition leads to No Low Memory Resolver Alternative means to avoid the code smell False positives UI Overdraw HashMap Usage Technical details Leaking Inner Class Prevalent programming fashions Occurrences that are:
Member Ignoring Method Unsupported Hardware Acceleration Absence of alternatives
76% of the instances False positives
126
static
Member Ignoring Method
127
Gap Simplified rule
Member Ignoring Method
«When faced with a difficult question, we often answer an easier one instead, usually without noticing the substitution»
128
Daniel Kahneman - Thinking, Fast and Slow
Inaccurate rules
129
Inaccurate rules
130
Semi automated process Official documentation Developer blogs & talks Q&A forums Catalog of 30 Android code smells ... performance smells
131
Error-prone Inaccurate Inaccurate
Understanding mobile code smells
132
133
134
135
136
Code smell definition Code smell detector Code smell instances Properties extractor Accepted instances Rejected instances Definition tuner
suggests
137
138
Ignorance & Oversight Mindsets Linters help! Need other tools Flawed definitions Common Mobile code smells
138
Collaborations
139
○
Professor Naouel Moha ○ Two research visits
Collaborations
140
○
Professor Xavier Blanc ○ One research visit
Publications
141
performance concerns in Android apps. In ASE18-Proceedings of the 33rd IEEE/ACM International Conference on Automated Software Engineering, 2018.
is to blame? In MSR2019-Proceedings of the 16th International Conference on Mining Software Repositories, 2019.
smells in the wild. In MOBILESoft19-Proceedings of the 6th IEEE/ACM International Conference on Mobile Software Engineering and Systems, 2019.
apps: How do they compare to Android? In MOBILESoft17-Proceedings of the 4th IEEE/ACM International Conference on Mobile Software Engineering and Systems, 2017.
Publications (under evaluation)
142
Death and Beyond. In Journal of Systems and Software, 2019.
143
Ignorance & Oversight Mindsets Linters help! Need other tools Flawed definitions Common Mobile code smells
143
144
Easy xkcd
145
Individual attitudes
The general apathy towards issues of technical debt and software quality can be a factor in technical debt accrual. These attitudes influence individual decisions to create a technical debt, and can also bring about a higher level of carelessness. “if you have a lot of Java developers who are very experienced in java and don’t care about the JavaScript they’re writing, most of the JavaScript is going to wind up being a form of technical debt”
146
Nested classes
Static Nested Classes:
Inner Nested Classes:
147
Leaking Inner Class
container
a reference to the inner object, without regard to the containing object
148
General research questions
1. Why are mobile code smells so common? 2. What do developers think about mobile code smells? 3. What are the adequate tools for tackling mobile code smells?
149
150
Survival regression
λ(t|x) = b0(t) + b1(t) ∗ x1 + ... + bn(t) ∗ xn
151
Variables: project properties
○ #Classes ○ #Commits ○ #Developers
○ #Releases ○ Cycle
152
153
Positive coefficient → Good for hazard → Bad for survival → Organisation matters