Abstract
Mobile applications (apps) are developed quickly and evolve continuously. Each development iteration may introduce poor design choices, and therefore produce code smells. Code smells complexify source code and may impede the evolution and performance of mobile apps. In addition to common object-oriented code smells, mobile apps have their own code smells because of their limitations and constraints on resources like memory, performance and energy consumption. Some of these mobile-specific smells are behavioural because they describe an inappropriate behaviour that may negatively impact software quality. Many tools exist to detect code smells in mobile apps, based specifically on static analysis techniques. In this paper, we are especially interested in two tools: Paprika and aDoctor. Both tools use representative techniques from the literature and contain behavioural code smells. We analyse the effectiveness of behavioural code smells detection in practice within the tools of concern by performing an empirical study of code smells detected in apps. This empirical study aims to answer two research questions. First, are the detection tools effective in detecting behavioural code smells? Second, are the behavioural code smells detected by the tools consistent with their original literal definition? We emphasise the limitations of detection using only static techniques and the lessons learned from our empirical study. This study shows that established static analysis methods deemed to be effective for code smells detection are inadequate for behavioural mobile code smells detection.
















Similar content being viewed by others
References
Almalki K (2018) Bad droid! An in-depth empirical study on the occurrence and impact of android specific code smells. Ph.D. thesis, Rochester Institute of Technology
Banerjee A, Chong L K, Chattopadhyay S, Roychoudhury A (2014) Detecting energy bugs and hotspots in mobile apps. In: Proceedings of the 22nd ACM SIGSOFT international symposium on foundations of software engineering
Dennis C, Krutz D E, Mkaouer M W (2017) P-lint: a permission smell detector for android applications. In: 2017 IEEE/ACM 4th international conference on mobile software engineering and systems (MOBILESoft), pp 219–220
Developer.Android (2022) Onlowmemory. https://developer.android.com/reference/android/content/ComponentCallbacks#onLowMemory(). Online, Accessed Aug 2022
Developer.Android (2020) Arraymap. https://developer.android.com/reference/android/support/v4/util/ArrayMap.html. Online, Accessed Aug 2022
Elsayed E K, ElDahshan K A, El-Sharawy E E, Ghannam N E (2019) Reverse engineering approach for improving the quality of mobile applications. PeerJ Comput Sci 5
Emden E V, Moonen L (2002) Java quality assurance by detecting code smells. In: Ninth working conference on reverse engineering. Proceedings, pp 97–106
Fard A M, Mesbah A (2013) Jsnose: detecting javascript code smells. In: 2013 IEEE 13th international working conference on source code analysis and manipulation (SCAM), pp 116–125
Fowler M (1999) Refactoring—improving the design of existing code, 1 edn. Addison-Wesley
Gadient P, Ghafari M, Frischknecht P, Nierstrasz O (2018) Security code smells in android icc. Empir Softw Eng 1–31
Ghafari M, Gadient P, Nierstrasz O (2017) Security smells in android. In: 2017 IEEE 17th international working conference on source code analysis and manipulation (SCAM), pp 121–130
Gottschalk M, Josefiok M, Jelschen J, Winter A (2012) Removing energy code smells with reengineering services. In: GI-Jahrestagung
Haase C (2015) Developing for android ii the rules: memory. https://medium.com/google-developers/developing-for-android-ii-bb9a51f8c8b9. Online, Accessed May 2021
Habchi S, Hecht G, Rouvoy R, Moha N (2017) Code smells in ios apps: how do they compare to android?. In: 2017 IEEE/ACM 4th international conference on mobile software engineering and systems (MOBILESoft), pp 110–121
Habchi S, Blanc X, Rouvoy R (2018) On adopting linters to deal with performance concerns in android apps. In: 2018 33rd IEEE/ACM international conference on automated software engineering (ASE), pp 6–16
Habchi S, Moha N, Rouvoy R (2019a) The rise of android code smells: Who is to blame?. In: 2019 IEEE/ACM 16th international conference on mining software repositories (MSR), pp 445–456
Habchi S, Rouvoy R, Moha N (2019b) On the survival of android code smells in the wild. In: 2019 IEEE/ACM 6th international conference on mobile software engineering and systems (MOBILESoft), pp 87–98
Hecht G (2016) Détection et analyse de l’impact des défauts de code dans les applications mobiles. (detection and analysis of impact of code smells in mobile applications). Ph.D. thesis, Université du Québec à Montréal
Hecht G, Rouvoy R, Moha N, Duchien L (2015) Detecting antipatterns in android apps. In: 2015 2nd ACM international conference on mobile software engineering and systems, pp 148–149
Iannone E, Pecorelli F, Nucci D D, Palomba F, Lucia A (2020) Refactoring android-specific energy smells: a plugin for android studio. In: Proceedings of the 28th international conference on program comprehension
Ibrahim R, Ahmed M, Nayak R, Jamel S (2020) Reducing redundancy of test cases generation using code smell detection and refactoring. J King Saud Univ—Comput Inf Sci 32(3):367–374
Johnson B, Song Y, Murphy-Hill E R, Bowdidge R W (2013) Why don’t software developers use static analysis tools to find bugs?. In: 2013 35th International conference on software engineering (ICSE), pp 672–681
Kessentini M, Ouni A (2017) Detecting android smells using multi-objective genetic programming. In: 2017 IEEE/ACM 4th international conference on mobile software engineering and systems (MOBILESoft), pp 122–132
Kumar S, Chhabra J K (2014) Two level dynamic approach for feature envy detection. In: 2014 International conference on computer and communication technology (ICCCT), pp 41–46
Lim D (2018) Detecting code smells in android applications. Master’s thesis, TU Delft
Lin Y, Okur S (2015) Study and refactoring of android asynchronous programming
Malavolta I, Verdecchia R, Filipovic B, Bruntink M, Lago P (2018) How maintainability issues of android apps evolve. In: 2018 IEEE International conference on software maintenance and evolution (ICSME), pp 334–344
Mannan U A, Ahmed I, Almurshed R A M, Dig D, Jensen C (2016) Understanding code smells in android applications. In: 2016 IEEE/ACM International conference on mobile software engineering and systems (MOBILESoft), pp 225–236
Marinescu C, Marinescu R, Mihancea P F, Ratiu D, Wettel R (2005) iplasma: an integrated platform for quality assessment of object-oriented design. In: ICSM
Mariotti G (2013a) Antipattern: freezing a ui with broadcast receiver http://gmariotti.blogspot.ca/2013/02/antipattern-freezing-ui-with-broadcast.html. Online, Accessed May 2021
Mariotti G (2013b) Antipattern: freezing the ui with a service and an intentservice http://gmariotti.blogspot.com/2013/03/antipattern-freezing-ui-with-service.html. Online, Accessed: May 2021
Mariotti G (2013c) Antipattern: freezing the ui with an asynctask http://gmariotti.blogspot.com/2013/02/antipattern-freezing-ui-with-asynctask.html. Online, Accessed May 2021
Moha N, Guéhéneuc Y G, Duchien L, Meur A F L (2010) Decor: a method for the specification and detection of code and design smells. IEEE Trans Softw Eng 36:20–36
Morales R, Saborido R, Khomh F, Chicano F, Antoniol G (2018) [journal first] earmo: an energy-aware refactoring approach for mobile apps. In: 2018 IEEE/ACM 40th international conference on software engineering (ICSE), pp 59–59
Ni-Lewis I (2015) Avoiding allocations in ondraw() (100 days of google dev) https://youtu.be/{HAK}5acHQ53e. Online, Accessed May 2021
Oracle (2020) Java thread primitive deprecation. https://docs.oracle.com/javase/8/docs/technotes/guides/concurrency/threadPrimitiveDeprecation.html. Online, Accessed: May 2021
Palomba F, Nucci D D, Panichella A, Zaidman A, Lucia A D (2017) Lightweight detection of android-specific code smells: The adoctor project. In: 2017 IEEE 24th international conference on software analysis, evolution and reengineering (SANER), pp 487–491
Paternò F, Schiavone A G, Conte A (2017) Customizable automatic detection of bad usability smells in mobile accessed web applications. In: Proceedings of the 19th international conference on human-computer interaction with mobile devices and services
Peruma A S (2018) What the smell? An empirical investigation on the distribution and severity of test smells in open source android applications
Rasool G, Ali A (2020) Recovering android bad smells from android applications. Arab J Sci Eng 45. https://doi.org/10.1007/s13369-020-04365-1
Reimann J, Brylski M, Aßmann U (2014) A tool-supported quality smell catalogue for android developers. Softwaretechnik-Trends 34
Rubin J, Henniche A N, Moha N, Bouguessa M, Bousbia N (2019) Sniffing android code smells: an association rules mining-based approach. In: 2019 IEEE/ACM 6th international conference on mobile software engineering and systems (MOBILESoft), pp 123–127
Statista (2020) Number of apps available in leading app stores as of 1st quarter 2020 https://www.statista.com/statistics/276623/number-of-apps-available-in-leading-app-stores/. Online, Accessed May 2021
Statista (2020) Number of mobile app downloads worldwide from 2016 to 2019 https://www.statista.com/statistics/271644/worldwide-free-and-paid-mobile-app-store-downloads/. Online, Accessed May 2021
Study Artifacts (2021) https://figshare.com/s/8235a0575ff4a88f0deb. Online, Accessed: February 2022
Wohlin C, Runeson P, Höst M, Ohlsson M C, Regnell B (2000) Experimentation in software engineering. In: The Kluwer international series in software engineering
Author information
Authors and Affiliations
Corresponding author
Ethics declarations
Conflict of Interest
The authors declare that they have no conflict of interest.
Additional information
Communicated by: Tse-Hsun (Peter) Chen, Cor-Paul Bezemer, André van Hoorn, Catia Trubiani, Weiyi Shang
Publisher’s note
Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.
This article belongs to the Topical Collection: Software Performance
Rights and permissions
Springer Nature or its licensor holds exclusive rights to this article under a publishing agreement with the author(s) or other rightsholder(s); author self-archiving of the accepted manuscript version of this article is solely governed by the terms of such publishing agreement and applicable law.
About this article
Cite this article
Prestat, D., Moha, N. & Villemaire, R. An empirical study of Android behavioural code smells detection. Empir Software Eng 27, 179 (2022). https://doi.org/10.1007/s10664-022-10212-8
Accepted:
Published:
DOI: https://doi.org/10.1007/s10664-022-10212-8