Understanding Code Smells in Android Applications

Code smells are associated with poor coding practices that cause long-term maintainability problems and mask bugs. Despite mobile being a fast growing software sector, code smells in mobile applications have been understudied. We do not know how code smells in mobile applications compare to those in desktop applications, and how code smells are affecting the design of mobile applications. Without such knowledge, application developers, tool builders, and researchers cannot improve the practice and state of the art of mobile development.We first reviewed the literature on code smells in Android applications and found that there is a significant gap between the most studied code smells in literature and most frequently occurring code smells in real world applications. Inspired by this finding, we conducted a large scale empirical study to compare the type, density, and distribution of code smells in mobile vs. desktop applications. We analyze an open-source corpus of 500 Android applications (total of 6.7M LOC) and 750 desktop Java applications (total of 16M LOC), and compare 14,553 instances of code smells in Android applications to 117,557 instances of code smells in desktop applications. We find that, despite mobile applications having different structure and workflow than desktop applications, the variety and density of code smells is similar. However, the distribution of code smells is different – some code smells occur more frequently in mobile applications. We also found that different categories of Android applications have different code smell distributions. We highlight several implications of our study for application developers, tool builders, and researchers.

[1]  Gabriele Bavota,et al.  Detecting bad smells in source code using change history information , 2013, 2013 28th IEEE/ACM International Conference on Automated Software Engineering (ASE).

[2]  Ahmed E. Hassan,et al.  Fresh apps: an empirical study of frequently-updated mobile apps in the Google play store , 2015, Empirical Software Engineering.

[3]  Ward Cunningham,et al.  The WyCash portfolio management system , 1992, OOPSLA '92.

[4]  Foutse Khomh,et al.  Is it a bug or an enhancement?: a text-based approach to classify change requests , 2008, CASCON '08.

[5]  Mauricio A. Saca Refactoring improving the design of existing code , 2017, 2017 IEEE 37th Central America and Panama Convention (CONCAPAN XXXVII).

[6]  Andreas Zeller,et al.  It's not a bug, it's a feature: How misclassification impacts bug prediction , 2013, 2013 35th International Conference on Software Engineering (ICSE).

[7]  Uwe Aßmann,et al.  A Tool-Supported Quality Smell Catalogue For Android Developers , 2014, Softwaretechnik-Trends.

[8]  Daniela Cruzes,et al.  The evolution and impact of code smells: A case study of two open source systems , 2009, 2009 3rd International Symposium on Empirical Software Engineering and Measurement.

[9]  Gabriele Bavota,et al.  Landfill: An Open Dataset of Code Smells with Public Evaluation , 2015, 2015 IEEE/ACM 12th Working Conference on Mining Software Repositories.

[10]  Gabriele Bavota,et al.  Mining Version Histories for Detecting Code Smells , 2015, IEEE Transactions on Software Engineering.

[11]  James M. Bieman,et al.  Testing Consequences of Grime Buildup in Object Oriented Design Patterns , 2008, 2008 1st International Conference on Software Testing, Verification, and Validation.

[12]  Ioannis Stamelos,et al.  An empirical investigation of an object-oriented design heuristic for maintainability , 2003, J. Syst. Softw..

[13]  Arthur J. Riel,et al.  Object-Oriented Design Heuristics , 1996 .

[14]  Aiko Fallas Yamashita,et al.  Do developers care about code smells? An exploratory survey , 2013, 2013 20th Working Conference on Reverse Engineering (WCRE).

[15]  Ioannis Stamelos,et al.  A controlled experiment investigation of an object-oriented design heuristic for maintainability , 2004, J. Syst. Softw..

[16]  Michele Lanza,et al.  Object-Oriented Metrics in Practice - Using Software Metrics to Characterize, Evaluate, and Improve the Design of Object-Oriented Systems , 2006 .

[17]  Jonathan I. Maletic,et al.  A survey and taxonomy of approaches for mining software repositories in the context of software evolution , 2007, J. Softw. Maintenance Res. Pract..

[18]  Lucas Batista Leite de Souza,et al.  Do software categories impact coupling metrics? , 2013, 2013 10th Working Conference on Mining Software Repositories (MSR).

[19]  Denys Poshyvanyk,et al.  Blending Conceptual and Evolutionary Couplings to Support Change Impact Analysis in Source Code , 2010, 2010 17th Working Conference on Reverse Engineering.

[20]  Martin P. Robillard,et al.  A field study of API learning obstacles , 2011, Empirical Software Engineering.

[21]  Yuanyuan Zhang,et al.  The App Sampling Problem for App Store Mining , 2015, 2015 IEEE/ACM 12th Working Conference on Mining Software Repositories.

[22]  Uwe Aßmann,et al.  On the reuse and recommendation of model refactoring specifications , 2012, Software & Systems Modeling.

[23]  Nong Ye,et al.  Naïve Bayes Classifier , 2013 .

[24]  Robert C. Martin Agile Software Development, Principles, Patterns, and Practices , 2002 .

[25]  Forrest Shull,et al.  Building empirical support for automated code smell detection , 2010, ESEM '10.

[26]  Cristina Marinescu,et al.  iPlasma: An Integrated Platform for Quality Assessment of Object-Oriented Design , 2005, ICSM.

[27]  Romain Rouvoy,et al.  Tracking the Software Quality of Android Applications Along Their Evolution (T) , 2015, 2015 30th IEEE/ACM International Conference on Automated Software Engineering (ASE).

[28]  D. Verloop,et al.  Code Smells in the Mobile Applications Domain , 2013 .

[29]  Romain Rouvoy,et al.  Detection of Anti-patterns in Mobile Applications , 2014 .

[30]  Baldoino Fonseca dos Santos Neto,et al.  Using developers' feedback to improve code smell detection , 2015, SAC.

[31]  Iftekhar Ahmed,et al.  An Empirical Study of Design Degradation: How Software Projects Get Worse over Time , 2015, 2015 ACM/IEEE International Symposium on Empirical Software Engineering and Measurement (ESEM).

[32]  Francesca Arcelli Fontana,et al.  On Investigating Code Smells Correlations , 2011, 2011 IEEE Fourth International Conference on Software Testing, Verification and Validation Workshops.

[33]  郑肇葆,et al.  基于Naive Bayes Classifiers的航空影像纹理分类 , 2006 .

[34]  Raed Shatnawi,et al.  An empirical study of the bad smells and class error probability in the post-release object-oriented system evolution , 2007, J. Syst. Softw..

[35]  吴树峰 从学徒到大师之路--读《 The Pragmatic Programmer, From Journeyman to Master》 , 2007 .

[36]  Iftekhar Ahmed,et al.  An Exploration of Code Quality in FOSS Projects , 2014, OSS.

[37]  Uwe Aßmann,et al.  Quality-Aware Refactoring for Early Detection and Resolution of Energy Deficiencies , 2013, 2013 IEEE/ACM 6th International Conference on Utility and Cloud Computing.

[38]  Geoffrey Hecht,et al.  An Approach to Detect Android Antipatterns , 2015, 2015 IEEE/ACM 37th IEEE International Conference on Software Engineering.

[39]  F Arcelli Fontana,et al.  Is it a Real Code Smell to be Removed or not , 2013 .

[40]  Thomas J. Mowbray,et al.  AntiPatterns: Refactoring Software, Architectures, and Projects in Crisis , 1998 .