skip to main content
10.1145/3422392.3422432acmotherconferencesArticle/Chapter ViewAbstractPublication PagessbesConference Proceedingsconference-collections
research-article

A Catalog of Object-Relational Mapping Code Smells for Java

Published:21 December 2020Publication History

ABSTRACT

Bad choices during software development might lead to maintenance and performance issues. Code smells are typically used to indicate such problems. A number of smells have been proposed, usually focused on generic code problems. In this work, we focus on the specifics of Object-Relational Mapping (ORM) code in Java. Developers use ORM frameworks to abstract the complexity of accessing a database. However, when poorly used, frameworks can lead to problems that might affect the overall performance of the system. Therefore, we present a catalog of eight smells extracted from the state of research and practice, through a combination of rapid review and grey literature review. For each smell, we also present a suggested solution and rationale. To evaluate the catalog, we conducted a survey with 86 respondents. The majority of the respondents agree both that the code smells are a problem, as well as that the suggested solution is adequate. In conclusion, this work contributes with a systematic way of describing ORM code smells and an initial catalog, which can be useful for researchers and practitioners, positively evaluated by our initial results.

References

  1. Sayem Ahmed. 2018. JPA Tips: Avoiding the N + 1 select problem. Retrieved Feb. 16, 2020 from https://www.javacodegeeks.com/2018/04/jpa-tips-avoiding-the-n- 1-select-problem.htmlGoogle ScholarGoogle Scholar
  2. Maurício Aniche, Gabriele Bavota, Christoph Treude, Marco Aurélio Gerosa, and Arie van Deursen. 2018. Code smells for model-view-controller architectures. Empirical Software Engineering (2018).Google ScholarGoogle Scholar
  3. Mat B. 2011. Hibernate performance - Stack Overflow. Retrieved Feb. 16, 2020 from https://stackoverflow.com/questions/5155718/hibernate-performanceGoogle ScholarGoogle Scholar
  4. Christian Bauer, Gavin King, and Gary Gregory. 2016. Java Persistence with Hibernate. Manning Publications Co.Google ScholarGoogle Scholar
  5. Bruno Cartaxo, Gustavo Pinto, and Sergio Soares. 2018. The Role of Rapid Reviews in Supporting Decision-Making in Software Engineering Practice. In EASE'18.Google ScholarGoogle Scholar
  6. Bruno Cartaxo, Gustavo Pinto, and Sergio Soares. 2020. Contemporary Empirical Methods in Software Engineering (1 ed.). Springer, Chapter Rapid Reviews in Software Engineering.Google ScholarGoogle Scholar
  7. T. Chen. 2015. Improving the quality of large-scale database-centric software systems by analyzing database access code. In ICDEW'15.Google ScholarGoogle ScholarCross RefCross Ref
  8. T. Chen, W. Shang, Z. M. Jiang, A. E. Hassan, M. Nasser, and P. Flora. 2014. Detecting Performance Anti-patterns for Applications Developed Using Object-relational Mapping. (2014).Google ScholarGoogle Scholar
  9. T. Chen, W. Shang, Z. M. Jiang, A. E. Hassan, M. Nasser, and P. Flora. 2016. Finding and Evaluating the Performance Impact of Redundant Data Access for Applications that are Developed Using Object-Relational Mapping Frameworks. IEEE Transactions on Software Engineering (Dec 2016).Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. T. Chen, W. Shang, J. Yang, A. E. Hassan, M. W. Godfrey, M. Nasser, and P. Flora. 2016. An Empirical Study on the Practice of Maintaining Object-Relational Mapping Code in Java Systems. In MSR'16.Google ScholarGoogle Scholar
  11. Prem Devanbu, Thomas Zimmermann, and Christian Bird. 2016. Belief & Evidence in Empirical Software Engineering. In ICSE '16.Google ScholarGoogle Scholar
  12. Hippolyte Durix. 2020. Boost the performance of your Spring Data JPA application. Retrieved Feb. 16, 2020 from https://blog.ippon.tech/boost-the-performance-of-your-spring-data-jpa-applicationGoogle ScholarGoogle Scholar
  13. EclipseLink. 2019. What is Object-Relational Mapping. Retrieved Oct. 22, 2019 from https://wiki.eclipse.org/EclipseLink/FAQ/JPA#What_is_Object-Relational_MappingGoogle ScholarGoogle Scholar
  14. A. M. Fard and A. Mesbah. 2013. JSNOSE: Detecting JavaScript Code Smells. In SCAM '13.Google ScholarGoogle Scholar
  15. Martin Fowler. 1999. Refactoring: improving the design of existing code. Addison-Wesley, Reading, MA.Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. J. Garcia, D. Popescu, G. Edwards, and N. Medvidovic. 2009. Identifying Architectural Bad Smells. In CSMR'09.Google ScholarGoogle Scholar
  17. Vahid Garousi, Michael Felderer, and Mika V. Mäntylä. 2019. Guidelines for including grey literature and conducting multivocal literature reviews in software engineering. Information and Software Technology (2019).Google ScholarGoogle Scholar
  18. Gustavo Gomes. 2016. Performance Improvement in Java Applications: ORM / JPA. Retrieved Feb. 16, 2020 from https://dzone.com/articles/performance-improvement-in-java-applications-orm-jGoogle ScholarGoogle Scholar
  19. Leo Goodman. 1961. Snowball Sampling. Ann Math Stat (1961).Google ScholarGoogle Scholar
  20. Chris Hut. 2015. Avoiding JPA Performance Pitfalls. Retrieved Feb. 16, 2020 from https://www.veracode.com/blog/secure-development/avoiding-jpa-performance-pitfallsGoogle ScholarGoogle Scholar
  21. Thorben Janssen. 2015. How to Improve JPA Performance | Rebel. Retrieved Feb. 16, 2020 from https://www.jrebel.com/blog/how-to-improve-jpa-performanceGoogle ScholarGoogle Scholar
  22. Thorben Janssen. 2017. Solve Hibernate Performance Issues in Development. Retrieved Feb. 16, 2020 from https://stackify.com/find-hibernate-performance-issuesGoogle ScholarGoogle Scholar
  23. Thorben Janssen. 2018. 3 Common Hibernate Performance Issues in Your Log. Retrieved Feb. 16, 2020 from https://www.baeldung.com/hibernate-common-performance-problems-in-logsGoogle ScholarGoogle Scholar
  24. Thorben Janssen. 2020. 7 Tips to boost your Hibernate performance - Thoughts on Java. Retrieved Feb. 16, 2020 from https://thoughts-on-java.org/tips-to-boost-your-hibernate-performanceGoogle ScholarGoogle Scholar
  25. Rod Johnson. 2005. J2EE Development Frameworks. Computer (Jan. 2005).Google ScholarGoogle Scholar
  26. Josh Juneau. 2018. The Query API and JPQL. In Java EE 8 Recipes. Springer.Google ScholarGoogle Scholar
  27. Foutse Khomh, Massimiliano Di Penta, and Yann-Gael Gueheneuc. 2009. An exploratory study of the impact of code smells on software change-proneness. In WCRE '09. IEEE.Google ScholarGoogle ScholarDigital LibraryDigital Library
  28. Michal Marciniec. 2019. JPA: N+1 SELECT problem. Retrieved Feb. 16, 2020 from https://codete.com/blog/jpa-n-plus-1-select-problemGoogle ScholarGoogle Scholar
  29. Igor Medeiros. 2015. Java Persistence API: Otimizando a performance das aplicações. Retrieved Feb. 16, 2020 from https://www.devmedia.com.br/javapersistence-api-otimizando-a-performance-das-aplicacoes/32091Google ScholarGoogle Scholar
  30. Vlad Mihalcea. 2016. Hibernate Performance Tuning and Best Practices. Retrieved Feb. 16, 2020 from https://in.relation.to/2016/09/28/performance-tuning-and-best-practicesGoogle ScholarGoogle Scholar
  31. Vlad Mihalcea. 2016. High-Performance Hibernate Devoxx France. Retrieved Feb. 16, 2020 from https://www.slideshare.net/VladMihalcea/high-performance-hibernate-devoxx-franceGoogle ScholarGoogle Scholar
  32. V. Mihalcea. 2016. High-Performance Java Persistence. Vlad Mihalcea.Google ScholarGoogle Scholar
  33. Vlad Mihalcea. 2017. Performance Features. Retrieved Feb. 02, 2020 from https://www.eclipse.org/eclipselink/documentation/2.7/solutions/performance001.htmGoogle ScholarGoogle Scholar
  34. Vlad Mihalcea. 2019. EAGER fetching is a code smell when using JPA and Hibernate. Retrieved Feb. 16, 2020fromhttps://vladmihalcea.com/eager-fetching-is-a-code-smellGoogle ScholarGoogle Scholar
  35. Vlad Mihalcea. 2019. Hibernate performance tuning tips. Retrieved Feb. 03, 2020 from https://vladmihalcea.com/hibernate-performance-tuning-tipsGoogle ScholarGoogle Scholar
  36. Vlad Mihalcea. 2019. The hibernate.enable_lazy_load_no_trans Anti-Pattern. Retrieved Jan. 19, 2020 from https://vladmihalcea.com/the-hibernate-enable_lazy_load_no_trans-anti-patternGoogle ScholarGoogle Scholar
  37. Vlad Mihalcea. 2019. How to detect the Hibernate N+1 query problem during testing. Retrieved Mar. 22, 2020 from https://vladmihalcea.com/how-to-detect-the-n-plus-one-query-problem-during-testingGoogle ScholarGoogle Scholar
  38. Vlad Mihalcea. 2020. The best way to handle the LazyInitializationException. Retrieved Mar. 20, 2020 from https://vladmihalcea.com/the-best-way-to-handle-the- lazyinitializationexceptionGoogle ScholarGoogle Scholar
  39. Vlad Mihalcea. 2020. prevent JPA and Hibernate performance issues. Retrieved Feb. 16, 2020 from https://vladmihalcea.com/jpa-hibernate-performance-issuesGoogle ScholarGoogle Scholar
  40. Vlad Mihalcea et al. 2018. Hibernate ORM 5.4.3. Final User Guide. Retrieved Feb. 16, 2020 from https://docs.jboss.org/hibernate/orm/5.4/userguide/html_single/Hibernate_User_Guide.htmlGoogle ScholarGoogle Scholar
  41. João Munhoz. 2019. Hibernate and the n+1 selections problem - QuintoAndar Tech. Retrieved Feb. 16, 2020 from https://medium.com/quintoandar-techblog/hibernate-and-the-n-1-selections-problem-c497710fa3feGoogle ScholarGoogle Scholar
  42. Marcos Felipe Carvalho Nazario, Eduardo Guerra, Rodrigo Bonifacio, and Gustavo Pinto. 2019. Detecting and Reporting Object-Relational Mapping Problems: An Industrial Report. In ESEM '19.Google ScholarGoogle Scholar
  43. A.N. Oppenheim. 2000. Questionnaire Design, Interviewing and Attitude Measurement. Bloomsbury Academic.Google ScholarGoogle Scholar
  44. Oracle. 2015. Oracle TopLink JPA Performance Tuning. Retrieved Feb. 16, 2020 from https://docs.oracle.com/middleware/1212/core/ASPER/toplink.htmGoogle ScholarGoogle Scholar
  45. Guy Paré, Marie-Claude Trudel, Mirou Jaana, and Spyros Kitsiou. 2015. Synthesizing information systems knowledge: A typology of literature reviews. Information & Management 52, 2 (2015).Google ScholarGoogle Scholar
  46. Edith Tom, Aybüke Aurum, and Richard Vidgen. 2013. An exploration of technical debt. Journal of Systems and Software (2013).Google ScholarGoogle Scholar
  47. T. Tsunoda, H. Washizaki, Y. Fukazawa, S. Inoue, Y. Hanai, and M. Kanazawa. 2017. Evaluating the work of experienced and inexperienced developers considering work difficulty in sotware development. In SNPD'17.Google ScholarGoogle Scholar
  48. Fabrício U. 2015. I discovered an undocumented way to improve JPA performance. Retrieved Feb. 16, 2020 from https://bewire.be/blog/i-discovered-an-undocumented-way-to-improve-jpa-performanceGoogle ScholarGoogle Scholar
  49. P. Węgrzynowicz. 2013. Performance antipatterns of one to many association in hibernate. In FedCSIS'13.Google ScholarGoogle Scholar
  50. Aiko Yamashita and Leon Moonen. 2013. Exploring the impact of inter-smell relations on software maintainability: An empirical study. In ICSE '13. IEEE Press.Google ScholarGoogle ScholarCross RefCross Ref

Index Terms

  1. A Catalog of Object-Relational Mapping Code Smells for Java
        Index terms have been assigned to the content through auto-classification.

        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
        • Published in

          cover image ACM Other conferences
          SBES '20: Proceedings of the XXXIV Brazilian Symposium on Software Engineering
          October 2020
          901 pages
          ISBN:9781450387538
          DOI:10.1145/3422392

          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: 21 December 2020

          Permissions

          Request permissions about this article.

          Request Permissions

          Check for updates

          Qualifiers

          • research-article
          • Research
          • Refereed limited

          Acceptance Rates

          Overall Acceptance Rate147of427submissions,34%

        PDF Format

        View or Download as a PDF file.

        PDF

        eReader

        View online with eReader.

        eReader