skip to main content
research-article

Is Static Analysis Able to Identify Unnecessary Source Code?

Published:30 January 2020Publication History
Skip Abstract Section

Abstract

Grown software systems often contain code that is not necessary anymore. Such unnecessary code wastes resources during development and maintenance, for example, when preparing code for migration or certification. Running a profiler may reveal code that is not used in production, but it is often time-consuming to obtain representative data in this way.

We investigate to what extent a static analysis approach, which is based on code stability and code centrality, is able to identify unnecessary code and whether its recommendations are relevant in practice. To study the feasibility and usefulness of our approach, we conducted a study involving 14 open-source and closed-source software systems. As there is no perfect oracle for unnecessary code, we compared recommendations for unnecessary code with historical cleanups, runtime usage data, and feedback from 25 developers of five software projects. Our study shows that recommendations generated from stability and centrality information point to unnecessary code that cannot be identified by dead code detectors. Developers confirmed that 34% of recommendations were indeed unnecessary and deleted 20% of the recommendations shortly after our interviews. Overall, our results suggest that static analysis can provide quick feedback on unnecessary code and is useful in practice.

References

  1. I. Ahmed, U. A. Mannan, R. Gopinath, and C. Jensen. 2015. An empirical study of design degradation: How software projects get worse over time. In Proceedings of the International Symposium on Empirical Software Engineering and Measurement. IEEE, 1--10.Google ScholarGoogle Scholar
  2. G. Canfora, L. Cerulo, M. Cimitile, and M. Di Penta. 2014. How changes affect software entropy: An empirical study. Empirical Software Engineering 19, 1 (2014), 1--38.Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. I. Şora. 2015. A PageRank based recommender system for identifying key classes in software systems. In Proceedings of the International Symposium on Applied Computational Intelligence and Informatics. IEEE, 495--500.Google ScholarGoogle ScholarCross RefCross Ref
  4. F. Deissenboeck, L. Heinemann, B. Hummel, and E. Juergens. 2010. Flexible architecture conformance assessment with ConQAT. In Proceedings of the International Conference on Software Engineering. ACM, 247--250.Google ScholarGoogle Scholar
  5. F. Dreier. 2015. Detection of Refactorings. Bachelor’s thesis. Technical University of Munich. Retrieved October 18, 2019 from https://www.cqse.eu/publications/2015-detection-of-refactorings.pdf.Google ScholarGoogle Scholar
  6. S. Eder, H. Femmer, B. Hauptmann, and M. Junker. 2014. Which features do my users (not) use? In Proceedings of the International Conference on Software Maintenance and Evolution. IEEE, 446--450.Google ScholarGoogle Scholar
  7. S. Eder, M. Junker, E. Juergens, B. Hauptmann, R. Vaas, and K. H. Prommer. 2012. How much does unused code matter for maintenance? In Proceedings of the International Conference on Software Engineering. IEEE/ACM, 1102--1111.Google ScholarGoogle Scholar
  8. M. Eichberg, B. Hermann, M. Mezini, and L. Glanz. 2015. Hidden truths in dead software paths. In Proceedings of the Joint Meeting of the European Software Engineering Conference and the ACM SIGSOFT Symposium on the Foundations of Software Engineering. ACM, 474--484.Google ScholarGoogle Scholar
  9. A. M. Fard and A. Mesbah. 2013. JsNose: Detecting JavaScript code smells. In Proceedings of the International Working Conference on Source Code Analysis and Manipulation. IEEE, 116--125.Google ScholarGoogle Scholar
  10. T. Gee. 2016. Unused Code Detection in IntelliJ IDEA 2016.3. Retrieved October 18, 2019 from https://www.youtube.com/watch?v=43-JEsM8QDQ.Google ScholarGoogle Scholar
  11. R. Haas. 2017. Identification of Unnecessary Source Code. Master’s thesis. Technical University of Munich.Google ScholarGoogle Scholar
  12. L. Heinemann, B. Hummel, and D. Steidl. 2014. Teamscale: Software quality control in real-time. In Proceedings of the International Conference on Software Engineering. ACM, 592--595.Google ScholarGoogle Scholar
  13. J. Spieler. 2019. UCDetector: Unnecessary Code Detector. Retrieved October 18, 2019 from http://www.ucdetector.org/.Google ScholarGoogle Scholar
  14. D. Jannach (Ed.). 2011. Recommender Systems: An Introduction. Cambridge University Press.Google ScholarGoogle Scholar
  15. Y. Jiang, D. Wu, and P. Liu. 2016. JRed: Program customization and bloatware mitigation based on static analysis. In Proceedings of the Annual Computer Software and Applications Conference. IEEE, 12--21.Google ScholarGoogle Scholar
  16. E. Juergens, F. Deissenboeck, B. Hummel, and S. Wagner. 2009. Do code clones matter? In Proceedings of the International Conference on Software Engineering. IEEE, 485--495.Google ScholarGoogle Scholar
  17. E. Juergens, M. Feilkas, M. Herrmannsdoerfer, F. Deissenboeck, R. Vaas, and K. H. Prommer. 2011. Feature profiling for evolving systems. In Proceedings of the International Conference on Program Comprehension. IEEE, 171--180.Google ScholarGoogle Scholar
  18. J. Krinke. 2008. Is cloned code more stable than non-cloned code? In Proceedings of the International Working Conference on Source Code Analysis and Manipulation. IEEE, 57--66.Google ScholarGoogle ScholarCross RefCross Ref
  19. J. Krinke. 2011. Is cloned code older than non-cloned code? In Proceedings of the International Workshop on Software Clones. IEEE, 28--33.Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. M. M. Lehman and L. A. Belady (Eds.). 1985. Program Evolution: Processes of Software Change. Academic Press Professional.Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. S. B. Maurer. 2014. Directed acyclic graphs. In Handbook of Graph Theory. CRC Press, 180--195.Google ScholarGoogle Scholar
  22. M. Mondal, C. K. Roy, Md. S. Rahman, R. K. Saha, J. Krinke, and K. A. Schneider. 2012. Comparative stability of cloned and non-cloned code: An empirical study. In Proceedings of the Annual Symposium on Applied Computing. ACM, 1227--1234.Google ScholarGoogle Scholar
  23. R. Moser, W. Pedrycz, and G. Succi. 2008. A comparative analysis of the efficiency of change metrics and static code attributes for defect prediction. In Proceedings of the International Conference on Software Engineering. ACM, 181--190.Google ScholarGoogle Scholar
  24. J. C. Munson and S. G. Elbaum. 1998. Code churn: A measure for estimating the impact of code change. In Proceedings of the International Conference on Software Maintenance. IEEE, 24--31.Google ScholarGoogle Scholar
  25. D. L. Parnas. 1994. Software aging. In Proceedings of the International Conference on Software Engineering. IEEE/ACM, 279--287.Google ScholarGoogle ScholarCross RefCross Ref
  26. N. Redini, R. Wang, A. Machiry, Y. Shoshitaishvili, G. Vigna, and C. Kruegel. 2019. BinTrimmer: Towards static binary debloating through abstract interpretation. In Detection of Intrusions and Malware, and Vulnerability Assessment, Roberto Perdisci, Clémentine Maurice, Giorgio Giacinto, and Magnus Almgren (Eds.). Springer, 482--501.Google ScholarGoogle Scholar
  27. M. P. Robillard, W. Maalej, R. J. Walker, and T. Zimmermann (Eds.). 2014. Recommendation Systems in Software Engineering. Springer.Google ScholarGoogle Scholar
  28. P. Runeson and M. Höst. 2008. Guidelines for conducting and reporting case study research in software engineering. Empirical Software Engineering 14, 2 (2008), 131--164.Google ScholarGoogle ScholarDigital LibraryDigital Library
  29. G. Scanniello. 2014. An investigation of object-oriented and code-size metrics as dead code predictors. In Proceedings of the EUROMICRO Conference on Software Engineering and Advanced Applications. IEEE, 392--397.Google ScholarGoogle ScholarDigital LibraryDigital Library
  30. H. Sharif, M. Abubakar, A. Gehani, and F. Zaffar. 2018. TRIMMER: Application specialization for code debloating. In Proceedings of the International Conference on Automated Software Engineering. ACM, 329--339.Google ScholarGoogle Scholar
  31. J. Siegmund, N. Siegmund, and S. Apel. 2015. Views on internal and external validity in empirical software engineering. In Proceedings of the International Conference on Software Engineering. IEEE, 9--19.Google ScholarGoogle Scholar
  32. D. Steidl, B. Hummel, and E. Juergens. 2012. Using network analysis for recommendation of central software classes. In Proceedings of the Working Conference on Reverse Engineering. IEEE, 93--102.Google ScholarGoogle Scholar
  33. F. Streitel, D. Steidl, and E. Jürgens. 2014. Dead code detection on class level. Softwaretechnik-Trends 34, 2 (2014).Google ScholarGoogle Scholar
  34. Unknown. 2019. Reduce your app size. Retrieved October 18, 2019 from https://developer.android.com/topic/performance/reduce-apk-size#remove-unused.Google ScholarGoogle Scholar
  35. H. Y. Yang, E. Tempero, and H. Melton. 2008. An empirical study into use of dependency injection in Java. In Proceedings of the Australian Conference on Software Engineering. IEEE, 239--247.Google ScholarGoogle Scholar
  36. A. Zaidman and S. Demeyer. 2008. Automatic identification of key classes in a software system using webmining techniques. Journal of Software Maintenance and Evolution: Research and Practice 20, 6 (2008), 387--417.Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Is Static Analysis Able to Identify Unnecessary Source Code?

              Recommendations

              Comments

              Login options

              Check if you have access through your login credentials or your institution to get full access on this article.

              Sign in

              Full Access

              • Published in

                cover image ACM Transactions on Software Engineering and Methodology
                ACM Transactions on Software Engineering and Methodology  Volume 29, Issue 1
                January 2020
                317 pages
                ISSN:1049-331X
                EISSN:1557-7392
                DOI:10.1145/3375995
                • Editor:
                • Mauro Pezzè
                Issue’s Table of Contents

                Copyright © 2020 ACM

                Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than the author(s) must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected].

                Publisher

                Association for Computing Machinery

                New York, NY, United States

                Publication History

                • Published: 30 January 2020
                • Accepted: 1 October 2019
                • Revised: 1 September 2019
                • Received: 1 March 2019
                Published in tosem Volume 29, Issue 1

                Permissions

                Request permissions about this article.

                Request Permissions

                Check for updates

                Qualifiers

                • research-article
                • Research
                • Refereed

              PDF Format

              View or Download as a PDF file.

              PDF

              eReader

              View online with eReader.

              eReader

              HTML Format

              View this article in HTML Format .

              View HTML Format