understanding mobile specific code smells
play

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


  1. Understanding mobile-specific code smells Presented by: Sarra Habchi Advisor: Examiners: - Romain Rouvoy - Jean-Christophe Routier Rapporteurs: - Naouel Moha - Andy Zaidman - Tegawendé-François Bissyande - Yann-Gaël Guéhéneuc

  2. 2 Raconteur.net

  3. 3

  4. 4

  5. 5

  6. 6

  7. 7

  8. 8

  9. Performance matters! 9

  10. Performance practices matter! 10

  11. Performance bad practices 11

  12. Performance bad practices ● Resource leaks (Guo et al. 2013) ● 3 anti-patterns (Liu et al. 2014) ● 30 code smells (Reimann et al. 2014) → Mobile-specific code smells 12

  13. Mobile-specific code smells ● Catalog ● Reused & extended in later studies ● 14 studies 13

  14. Official documentation Catalog of 30 Developer Android code smells Semi-automated blogs & talks ... analysis performance Q&A forums 14

  15. UI Overdraw 15

  16. 1 overdraw 2 overdraws 3 overdraws 4 overdraws 16

  17. Detection tools 17

  18. Detection tools ● Paprika (Hecht et al. 2015) ● aDoctor (Palomba et al. 2017) ● MOGP approach (Kessentini and Ouni 2017) 18

  19. Impact on performance 19

  20. Impact on performance ● UI & Memory (Hecht et al. 2016) ● Energy (Carette et al. 2017) ● Energy (Palomba et al. 2019) 20

  21. Code smell Detection Impact on catalog tools performance ? 21

  22. 22

  23. Causes Relevance Adequate tools 23

  24. We have: Code smell Detection Impact on catalog tools performance We lack: Understand Refactoring Refactoring code smells catalog tools 24

  25. 1. Extent 2. Causes 3. Developers’ perception Understanding mobile code smells 25

  26. 1. Extent 2. Causes 3. Developers’ perception Understanding mobile code smells 26

  27. 27

  28. Code Smells in iOS Apps: How do they compare to Android? ● Identified 6 iOS-specific code smells ● Common code smells between Android and iOS ● Proposed a detection tool for iOS ● Android apps tend to have more smells than the iOS ones 28

  29. 1. Extent 2. Causes 3. Developers’ perception Understanding mobile code smells 29

  30. 1. Extent 2. Causes 3. Developers’ perception Understanding mobile code smells 30

  31. Motives of technical debt (Tom et al. 2013) Pragmatism Prioritisation Process Attitudes Ignorance Oversight 31

  32. Motives of technical debt (Tom et al. 2013) Pragmatism Prioritisation Process Attitudes Ignorance Oversight 32

  33. Motives of technical debt (Tom et al. 2013) Pragmatism Prioritisation Process Attitudes Ignorance Oversight 33

  34. 34

  35. 1- Commits 2- Developers 3- Survival 35

  36. 1- Commits 2- Developers 3- Survival 36

  37. Code smell Code smell removal introduction ... ... Commit 0 Commit 1 Commit k Commit n Instance A Instance A Instance A Instance A Instance B Instance B 37

  38. Instance A Instance A Instance C ... Commit p Commit m ... ... Commit 0 Commit 1 Commit k Commit n Instance A Instance A Instance A Instance A Instance B Instance B 38

  39. RegistrationSocket.java GcmSocket.java Commit 303d1ac : File renaming link Instance Instance RegistrationSocket$Verification GcmSocket$Verification 39

  40. Branches + Renamings 40

  41. 41

  42. Sniffer Git link to 1 -Extract app 2 - Detect 3 - Analyse Instances Commits an app data code smells change history Full code Repository smell history model 42

  43. Sniffer ● Track branches ● Detect renamings ● Validated with: ○ F1-score=0.96 43

  44. Dataset ● 324 open-source apps ● 255,000 commits ● 4,525 developers 44

  45. LIC Leaking Inner Class MIM Member Ignoring Method NLMR No Low Memory Resolver HMU HashMap Usage UIO UI Overdraw UHA Unsupported Hardware Acceleration IOD Init OnDraw UCS Unsuited Cache Size 45

  46. Introductions 46

  47. % Removals 47

  48. 79% of code smell instances are removed 48

  49. Intended removal? 49

  50. No Low Memory Resolver 50

  51. 51

  52. 52

  53. Source code deletion 53

  54. % Removals by deletion 54

  55. 59% of code smell removals are accompanied with source code deletion 55

  56. Manual analysis ● 561 code smell instances ○ Commit actions ○ Commit message 56

  57. How are code smells removed? ● Removal is a side effect of evolution ○ Source code deleted ○ Empty methods filled (MIM) 57

  58. How are code smells removed? ● Only refactoring: ○ Code smells detected by Android Lint ■ Init OnDraw (IOD) ■ UI Overdraw (UIO) 58

  59. Most of code smell removals are a side-effect of other activities 59

  60. Motives of technical debt Pragmatism Prioritisation Process Attitudes Ignorance Oversight 60

  61. How do releases impact code smell introductions and removals? 61

  62. 1 Day 1 Week 1 Month 62

  63. Releases do not have any impact on code smell introductions or removals. 63

  64. Motives of technical debt Pragmatism Prioritisation Process Attitudes Ignorance Oversight 64

  65. 1- Commits 2- Developers 3- Survival 65

  66. 1- Commits 2- Developers 3- Survival 66

  67. 67

  68. Who is involved? 68

  69. 69

  70. Mainly 38% 1 commit 70

  71. Involved developers 71

  72. Introducers Removers 72

  73. Introducers 18% 73

  74. Introducers BOTH Removers 18% 8% 74

  75. Expected Removals Introductions 75

  76. ⍴ = 0.77 76

  77. Introducers ≃ Removers 77

  78. Seniority and code smells ● Contribution = commits/project size ● Reputation ≃ followers “Developers with lots of followers were treated as local celebrities. Their activities were retold almost as local parable” 78 (Dabbish et al. 2012)

  79. ⍴ = 0.27 ⍴ = 0.24 79

  80. Junior Senior Junior Senior → Seniority does not impact developers’ behavior 80

  81. ● Introducers ⋍ Removers ● Newcomer ⟹ Bad contributor ฀ ● Senior || Reputable ⟹ Good contributor ฀ 81

  82. Motives of technical debt Pragmatism Prioritisation Process Attitudes Ignorance Oversight 82 82

  83. 1- Commits 2- Developers 3- Survival 83

  84. 1- Commits 2- Developers 3- Survival 84

  85. 85

  86. Survival analysis ● S(t) = Probability(t < T) ● T: a random lifetime from the population “Chances for a code smell to be still present in the source code after t time” ● 180.000 code smell lifelines 86

  87. 441 days 14 months 87

  88. 9 commits 88

  89. 14 months vs. 9 effective commits 89

  90. Variables: project properties ● Project size ○ #Classes ○ #Commits ○ #Developers ● Project releases ○ #Releases ○ Cycle 90

  91. Variables: Code smell properties ● Tool integration ○ Linted (detectable by Android Lint) ○ Linter priority ● Code smell type ○ Granularity 91

  92. Variables: Code smell properties ● Tool integration ○ Linted (detectable by Android Lint) ○ Linter priority ● Code smell type ○ Granularity 92

  93. → Static analysers have an impact on mobile code smells → Tool prioritisation matters 93

  94. 94

  95. Motives of technical debt Pragmatism Prioritisation Process Attitudes Ignorance Oversight 95 95

  96. 1. Extent 2. Causes: - Change history 3. Developers’ perception Understanding mobile code smells 96

  97. 1. Extent 2. Causes: - Change history 3. Developers’ perception Understanding mobile code smells 97

  98. 98

  99. Catalog of performance code smells How do they use the linter to deal with performance concerns? 99

  100. Semi-structured Experienced Interviews Android developers Analytical strategy Qualitative approach of (Schmidt et al. 2004) 100 100

Recommend


More recommend