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.
- 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 Scholar
- 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 ScholarDigital Library
- 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 ScholarCross Ref
- 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 Scholar
- 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 Scholar
- 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 Scholar
- 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 Scholar
- 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 Scholar
- 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 Scholar
- 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 Scholar
- R. Haas. 2017. Identification of Unnecessary Source Code. Master’s thesis. Technical University of Munich.Google Scholar
- 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 Scholar
- J. Spieler. 2019. UCDetector: Unnecessary Code Detector. Retrieved October 18, 2019 from http://www.ucdetector.org/.Google Scholar
- D. Jannach (Ed.). 2011. Recommender Systems: An Introduction. Cambridge University Press.Google Scholar
- 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 Scholar
- 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 Scholar
- 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 Scholar
- 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 ScholarCross Ref
- J. Krinke. 2011. Is cloned code older than non-cloned code? In Proceedings of the International Workshop on Software Clones. IEEE, 28--33.Google ScholarDigital Library
- M. M. Lehman and L. A. Belady (Eds.). 1985. Program Evolution: Processes of Software Change. Academic Press Professional.Google ScholarDigital Library
- S. B. Maurer. 2014. Directed acyclic graphs. In Handbook of Graph Theory. CRC Press, 180--195.Google Scholar
- 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 Scholar
- 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 Scholar
- 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 Scholar
- D. L. Parnas. 1994. Software aging. In Proceedings of the International Conference on Software Engineering. IEEE/ACM, 279--287.Google ScholarCross Ref
- 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 Scholar
- M. P. Robillard, W. Maalej, R. J. Walker, and T. Zimmermann (Eds.). 2014. Recommendation Systems in Software Engineering. Springer.Google Scholar
- 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 ScholarDigital Library
- 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 ScholarDigital Library
- 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 Scholar
- 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 Scholar
- 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 Scholar
- F. Streitel, D. Steidl, and E. Jürgens. 2014. Dead code detection on class level. Softwaretechnik-Trends 34, 2 (2014).Google Scholar
- Unknown. 2019. Reduce your app size. Retrieved October 18, 2019 from https://developer.android.com/topic/performance/reduce-apk-size#remove-unused.Google Scholar
- 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 Scholar
- 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 ScholarDigital Library
Index Terms
- Is Static Analysis Able to Identify Unnecessary Source Code?
Recommendations
Recommending unnecessary source code based on static analysis: poster
ICSE '19: Proceedings of the 41st International Conference on Software Engineering: Companion ProceedingsGrown software systems often contain code that is not necessary anymore. 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 ...
Detect Related Bugs from Source Code Using Bug Information
COMPSAC '10: Proceedings of the 2010 IEEE 34th Annual Computer Software and Applications ConferenceOpen source projects often maintain open bug repositories during development and maintenance, and the reporters often point out straightly or implicitly the reasons why bugs occur when they submit them. The comments about a bug are very valuable for ...
Impact of Comment Statement on Code Stability in Open Source Development
Proceedings of the 2008 conference on Knowledge-Based Software Engineering: Proceedings of the Eighth Joint Conference on Knowledge-Based Software EngineeringComment statements written in a source code are important information to understand and to maintain the source code. This paper performs an empirical study of impacts of comment statements on source code stability in an open source development. The ...
Comments