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.
- 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 Scholar
- 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 Scholar
- Mat B. 2011. Hibernate performance - Stack Overflow. Retrieved Feb. 16, 2020 from https://stackoverflow.com/questions/5155718/hibernate-performanceGoogle Scholar
- Christian Bauer, Gavin King, and Gary Gregory. 2016. Java Persistence with Hibernate. Manning Publications Co.Google Scholar
- 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 Scholar
- Bruno Cartaxo, Gustavo Pinto, and Sergio Soares. 2020. Contemporary Empirical Methods in Software Engineering (1 ed.). Springer, Chapter Rapid Reviews in Software Engineering.Google Scholar
- T. Chen. 2015. Improving the quality of large-scale database-centric software systems by analyzing database access code. In ICDEW'15.Google ScholarCross Ref
- 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 Scholar
- 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 ScholarDigital Library
- 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 Scholar
- Prem Devanbu, Thomas Zimmermann, and Christian Bird. 2016. Belief & Evidence in Empirical Software Engineering. In ICSE '16.Google Scholar
- 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 Scholar
- EclipseLink. 2019. What is Object-Relational Mapping. Retrieved Oct. 22, 2019 from https://wiki.eclipse.org/EclipseLink/FAQ/JPA#What_is_Object-Relational_MappingGoogle Scholar
- A. M. Fard and A. Mesbah. 2013. JSNOSE: Detecting JavaScript Code Smells. In SCAM '13.Google Scholar
- Martin Fowler. 1999. Refactoring: improving the design of existing code. Addison-Wesley, Reading, MA.Google ScholarDigital Library
- J. Garcia, D. Popescu, G. Edwards, and N. Medvidovic. 2009. Identifying Architectural Bad Smells. In CSMR'09.Google Scholar
- 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 Scholar
- 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 Scholar
- Leo Goodman. 1961. Snowball Sampling. Ann Math Stat (1961).Google Scholar
- Chris Hut. 2015. Avoiding JPA Performance Pitfalls. Retrieved Feb. 16, 2020 from https://www.veracode.com/blog/secure-development/avoiding-jpa-performance-pitfallsGoogle Scholar
- Thorben Janssen. 2015. How to Improve JPA Performance | Rebel. Retrieved Feb. 16, 2020 from https://www.jrebel.com/blog/how-to-improve-jpa-performanceGoogle Scholar
- Thorben Janssen. 2017. Solve Hibernate Performance Issues in Development. Retrieved Feb. 16, 2020 from https://stackify.com/find-hibernate-performance-issuesGoogle Scholar
- 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 Scholar
- 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 Scholar
- Rod Johnson. 2005. J2EE Development Frameworks. Computer (Jan. 2005).Google Scholar
- Josh Juneau. 2018. The Query API and JPQL. In Java EE 8 Recipes. Springer.Google Scholar
- 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 ScholarDigital Library
- Michal Marciniec. 2019. JPA: N+1 SELECT problem. Retrieved Feb. 16, 2020 from https://codete.com/blog/jpa-n-plus-1-select-problemGoogle Scholar
- 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 Scholar
- 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 Scholar
- Vlad Mihalcea. 2016. High-Performance Hibernate Devoxx France. Retrieved Feb. 16, 2020 from https://www.slideshare.net/VladMihalcea/high-performance-hibernate-devoxx-franceGoogle Scholar
- V. Mihalcea. 2016. High-Performance Java Persistence. Vlad Mihalcea.Google Scholar
- Vlad Mihalcea. 2017. Performance Features. Retrieved Feb. 02, 2020 from https://www.eclipse.org/eclipselink/documentation/2.7/solutions/performance001.htmGoogle Scholar
- 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 Scholar
- Vlad Mihalcea. 2019. Hibernate performance tuning tips. Retrieved Feb. 03, 2020 from https://vladmihalcea.com/hibernate-performance-tuning-tipsGoogle Scholar
- 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 Scholar
- 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 Scholar
- 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 Scholar
- Vlad Mihalcea. 2020. prevent JPA and Hibernate performance issues. Retrieved Feb. 16, 2020 from https://vladmihalcea.com/jpa-hibernate-performance-issuesGoogle Scholar
- 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 Scholar
- 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 Scholar
- 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 Scholar
- A.N. Oppenheim. 2000. Questionnaire Design, Interviewing and Attitude Measurement. Bloomsbury Academic.Google Scholar
- Oracle. 2015. Oracle TopLink JPA Performance Tuning. Retrieved Feb. 16, 2020 from https://docs.oracle.com/middleware/1212/core/ASPER/toplink.htmGoogle Scholar
- 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 Scholar
- Edith Tom, Aybüke Aurum, and Richard Vidgen. 2013. An exploration of technical debt. Journal of Systems and Software (2013).Google Scholar
- 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 Scholar
- 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 Scholar
- P. Węgrzynowicz. 2013. Performance antipatterns of one to many association in hibernate. In FedCSIS'13.Google Scholar
- 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 ScholarCross Ref
Index Terms
- A Catalog of Object-Relational Mapping Code Smells for Java
Recommendations
Are architectural smells independent from code smells? An empirical study
Highlights- Case study analyzing the correlations among code smells, groups of code smells and architectural smells.
AbstractBackground. Architectural smells and code smells are symptoms of bad code or design that can cause different quality problems, such as faults, technical debt, or difficulties with maintenance and evolution. Some studies ...
Prioritising Refactoring Using Code Bad Smells
ICSTW '11: Proceedings of the 2011 IEEE Fourth International Conference on Software Testing, Verification and Validation WorkshopsWe investigated the relationship between six of Fowler et al.'s Code Bad Smells (Duplicated Code, Data Clumps, Switch Statements, Speculative Generality, Message Chains, and Middle Man) and software faults. In this paper we discuss how our results can ...
An interactive ambient visualization for code smells
SOFTVIS '10: Proceedings of the 5th international symposium on Software visualizationCode smells are characteristics of software that indicate that code may have a design problem. Code smells have been proposed as a way for programmers to recognize the need for restructuring their software. Because code smells can go unnoticed while ...
Comments