Skip to main content
Log in

Understanding code smells in Elixir functional language

  • Published:
Empirical Software Engineering Aims and scope Submit manuscript

Abstract

Elixir is a functional programming language created in 2012, whose popularity is growing in the industry. Despite this fact, and to the best of our knowledge, there are few works in the literature focused on studying the internal quality of systems implemented with this language. In a preliminary and previous study, we conducted a grey literature review to provide an initial list of Elixir-specific code smells. Aiming to expand the results of this preliminary study, in this work we use a mixed methodology, based on the interaction with the Elixir developer community and on the mining of issues, commits, pull requests, and the source code in GitHub repositories to prospect and document new code smells for this language. As a result, we propose a catalog composed of 35 code smells, 23 of them are new and specific to Elixir, and 12 of them are traditional code smells, as cataloged by Fowler and Beck, which also affect Elixir systems. We validated this catalog by conducting a survey with 181 experienced Elixir developers from 37 countries and all continents. In this survey, we assessed the levels of relevance and prevalence of each smell in the catalog. We show that most smells in Elixir have relevance levels capable of impacting the readability, maintainability, and evolution of Elixir systems. Furthermore, most of the smells are not uncommon in production code. Our results have practical implications related to the prevention and removal of code smells in Elixir.

This is a preview of subscription content, log in via an institution to check access.

Access this article

Price excludes VAT (USA)
Tax calculation will be finalised during checkout.

Instant access to the full article PDF.

Fig. 1
Fig. 2
Fig. 3
Fig. 4

Similar content being viewed by others

Notes

  1. Elixir and mixture are synonymous terms in pharmacology. https://www.collinsdictionary.com/dictionary/english-thesaurus/elixir

  2. https://elixir-lang.org/cases.html

  3. https://www.phoenixframework.org/

  4. https://www.nerves-project.org/

  5. https://github.com/elixir-nx

  6. https://hexdocs.pm/iex/1.13/IEx.html

  7. https://web.archive.org/web/20071119175240/http://connect.microsoft.com/Phoenix

  8. Companies using Elixir in production code: https://elixir-companies.com

  9. https://plataformatec.com/

  10. https://livebook.dev/

  11. https://github.com/Finbits

  12. https://github.com/elixir-lang

  13. https://github.com/phoenixframework

  14. https://elixir-lang.org/getting-started/protocols.html

  15. Readers can also quickly check all these questions at: https://doi.org/10.5281/zenodo.7430258

  16. #MyElixirStatus and #ElixirLang

  17. https://www.ibm.com/spss

  18. When discussing each smell, we are adding between parentheses the acronym used in Fig. 4 (e.g., UNM) and the respective average score of the survey answers (e.g., 4.16).

  19. http://credo-ci.org/

References

  • Almeida U (2018) Learn functional programming with Elixir: new foundations for a new world, 1st edn. Pragmatic Bookshelf

  • Arnaoudova V, Di Penta M, Antoniol G (2016) Linguistic antipatterns: What they are and how developers perceive them. Empir Softw Eng 21(1):104–158. https://doi.org/10.1007/s10664-014-9350-8

    Article  Google Scholar 

  • Baltes S, Diehl S (2016) Worse than spam: Issues in sampling software developers. In: 10th ACM/IEEE International Symposium on Empirical Software Engineering and Measurement (ESEM). pp 1–6. https://doi.org/10.1145/2961111.2962628

  • Bordignon MD, Silva RA (2020) Mutation operators for concurrent programs in Elixir. In: 21st IEEE Latin-American Test Symposium (LATS). pp 1–6. https://doi.org/10.1109/LATS49555.2020.9093675

  • Borrelli A, Nardone V, Di Lucca GA, Canfora G, Di Penta M (2020) Detecting video game-specific bad smells in Unity projects. In: 17th International Conference on Mining Software Repositories (MSR). pp 198–208. https://doi.org/10.1145/3379597.3387454

  • Brown WJ, Malveau RC, McCormick HW, Mowbray TJ (1998) AntiPatterns: refactoring software, architectures, and projects in crisis. Wiley

  • Cowie J (2005) Detecting bad smells in haskell. Tech. rep., University of Kent, UK

  • Dabic O, Aghajani E, Bavota G (2021) Sampling projects in github for MSR studies. In: 18th IEEE/ACM International Conference on Mining Software Repositories (MSR). pp 560–564

  • Dong Y, Li Z, Tian Y, Sun C, Godfrey MW, Nagappan M (2022) Bash in the wild: language usage, code smells, and bugs. ACM Trans Softw Eng Methodol. https://doi.org/10.1145/3517193

  • Fard AM, Mesbah A (2013) Jsnose: detecting JavaScript code smells. In: 13th IEEE International Working Conference on Source Code Analysis and Manipulation (SCAM). pp 116–125. https://doi.org/10.1109/SCAM.2013.6648192

  • Ferreira F, Valente MT (2023) Detecting code smells in React-based web apps. Inf Softw Technol 155:1–16. https://doi.org/10.1016/j.infsof.2022.107111

    Article  Google Scholar 

  • Fontana FA, Ferme V, Marino A, Walter B, Martenka P (2013) Investigating the impact of code smells on system’s quality: an empirical study on systems of different application domains. In: 29th IEEE International Conference on Software Maintenance (ICSM). pp 260–269. https://doi.org/10.1109/ICSM.2013.37

  • Fowler M, Beck K (1999) Refactoring: improving the design of existing code, 1st edn. Addison-Wesley

  • Garousi V, Felderer M, Mäntylä MV (2019) Guidelines for including grey literature and conducting multivocal literature reviews in software engineering. Inf Softw Technol 106(1):101–121. https://doi.org/10.1016/j.infsof.2018.09.006

    Article  Google Scholar 

  • Habchi S, Hecht G, Rouvoy R, Moha N (2017) Code smells in iOS apps: how do they compare to Android? In: 4th IEEE/ACM International Conference on Mobile Software Engineering and Systems (MOBILESoft), pp 110–121. https://doi.org/10.1109/MOBILESoft.2017.11

  • Hecht G, Benomar O, Rouvoy R, Moha N, Duchien L (2015) Tracking the software quality of Android applications along their evolution. In: 30th IEEE/ACM International Conference on Automated Software Engineering (ASE). pp 236–247. https://doi.org/10.1109/ASE.2015.46

  • Kamei F, Wiese I, Lima C, Polato I, Nepomuceno V, Ferreira W, Ribeiro M, Pena C, Cartaxo B, Pinto G, Soares S (2021) Grey literature in software engineering: a critical review. Inf Softw Technol 138(1):1–26. https://doi.org/10.1016/j.infsof.2021.106609

    Article  Google Scholar 

  • Li W, Shatnawi R (2007) An empirical study of the bad smells and class error probability in the post-release object-oriented system evolution. J Syst Softw 80(7):1120–1128. https://doi.org/10.1016/j.jss.2006.10.018

    Article  Google Scholar 

  • Mäntylä MV, Lassenius C (2006) Subjective evaluation of software evolvability using code smells: an empirical study. Empir Softw Eng 11(3):395–431. https://doi.org/10.1007/s10664-006-9002-8

    Article  Google Scholar 

  • Nardone V, Muse BA, Abidi M, Khomh F, Penta MD (2022) Video game bad smells: What they are and how developers perceive them. ACM Trans Softw Eng Methodol. https://doi.org/10.1145/3563214. Just Accepted

  • Oizumi W, Garcia A, da Silva Sousa L, Cafeo B, Zhao Y (2016) Code anomalies flock together: exploring code anomaly agglomerations for locating design problems. In: 38th International Conference on Software Engineering (ICSE). pp 440–451. https://doi.org/10.1145/2884781.2884868

  • Oizumi WN, Garcia AF, Colanzi TE, Ferreira M, von Staa A (2014) When code-anomaly agglomerations represent architectural problems? an exploratory study. In: 28th Brazilian Symposium on Software Engineering (SBSE). pp 91–100. https://doi.org/10.1109/SBES.2014.18

  • Olbrich SM, Cruzes DS, Sjøberg DI (2010) Are all code smells harmful? a study of God Classes and Brain Classes in the evolution of three open source systems. In: 26th IEEE International Conference on Software Maintenance (ICSM). pp 1–10. https://doi.org/10.1109/ICSM.2010.5609564

  • Page L, Brin S, Motwani R, Winograd T (1999) The PageRank citation ranking: bringing order to the Web. Technical report, Stanford InfoLab

  • Palomba F, Bavota G, Penta MD, Oliveto R, Lucia AD (2014) Do they really smell bad? a study on developers’ perception of bad code smells. In: IEEE International Conference on Software Maintenance and Evolution (ICSME). pp 101–110. https://doi.org/10.1109/ICSME.2014.32

  • Punt L, Visscher S, Zaytsev V (2016) The A?B*A pattern: undoing style in CSS and refactoring opportunities it presents. In: 32nd IEEE International Conference on Software Maintenance and Evolution (ICSME). pp 67–77. https://doi.org/10.1109/ICSME.2016.73

  • Reimann J, Brylski M, Aßmann U (2014) A tool-supported quality smell catalogue for Android developers. In: Modellbasierte und modellgetriebene Softwaremodernisierung (MMSM). pp 1–2

  • Saboury A, Musavi P, Khomh F, Antoniol G (2017) An empirical study of code smells in JavaScript projects. In: 24th IEEE International Conference on Software Analysis, Evolution and Reengineering (SANER). pp 294–305. https://doi.org/10.1109/SANER.2017.7884630

  • Sharma T, Fragkoulis M, Spinellis D (2016) Does your configuration code smell? In: 13th IEEE/ACM Working Conference on Mining Software Repositories (MSR). pp 189–200

  • Siegel S, Castellan J (1988) Nonparametric Statistics for the Behavioral Sciences, 2nd edn. McGraw-Hill International Editions

  • Sobrinho EVdP, De Lucia A, Maia MdA (2021) A systematic literature review on bad smells-5 w’s: which, when, what, who, where. IEEE Trans Softw Eng 47(1):17–66. https://doi.org/10.1109/TSE.2018.2880977

    Article  Google Scholar 

  • Soh Z, Yamashita A, Khomh F, Guéhéneuc YG (2016) Do code smells impact the effort of different maintenance programming activities? In: 23rd IEEE International Conference on Software Analysis, Evolution, and Reengineering (SANER). pp 393–402. https://doi.org/10.1109/SANER.2016.103

  • Taibi D, Lenarduzzi V (2018) On the definition of microservice bad smells. IEEE Softw 35(3):56–62. https://doi.org/10.1109/MS.2018.2141031

    Article  Google Scholar 

  • Taibi D, Janes A, Lenarduzzi V (2017) How developers perceive smells in source code: a replicated study. Inf Softw Technol 92(1):223–235. https://doi.org/10.1016/j.infsof.2017.08.008

    Article  Google Scholar 

  • Thomas D (2018) Programming Elixir |\({>}\) 1.6: functional |\({>}\) concurrent |\({>}\) pragmatic |\({>}\) fun, 1st edn. Pragmatic Bookshelf

  • Vegi LFM, Valente MT (2022a) Catalog of Elixir-specific code smells. https://github.com/lucasvegi/Elixir-Code-Smells

  • Vegi LFM, Valente MT (2022b) Code smells in Elixir: early results from a grey literature review. In: 30th International Conference on Program Comprehension (ICPC). pp 1–5. https://doi.org/10.1145/3524610.3527881

  • Vegi LFM, Valente MT (2022c). Understanding code smells in Elixir functional language - Replication Package. https://doi.org/10.5281/zenodo.7430258

    Article  Google Scholar 

  • Wohlin C, Runeson P, Hst M, Ohlsson MC, Regnell B, Wessln A (2012) Experimentation in Software Engineering. Springer

  • Yamashita A, Moonen L (2012) Do code smells reflect important maintainability aspects? In: 28th IEEE International Conference on Software Maintenance (ICSM). pp 306–315. https://doi.org/10.1109/ICSM.2012.6405287

  • Yamashita A, Moonen L (2013a) Do developers care about code smells? an exploratory survey. In: 20th Working Conference on Reverse Engineering (WCRE). pp 242–251. https://doi.org/10.1109/WCRE.2013.6671299

  • Yamashita A, Moonen L (2013b) To what extent can maintenance problems be predicted by code smell detection? an empirical study. Inf Softw Technol 55(12):2223–2242. https://doi.org/10.1016/j.infsof.2013.08.002

    Article  Google Scholar 

  • Zhang H, Zhou X, Huang X, Huang H, Babar MA (2020) An evidence-based inquiry into the use of grey literature in software engineering. In: 42nd ACM/IEEE International Conference on Software Engineering (ICSE). pp 1422–1434. https://doi.org/10.1145/3377811.3380336

Download references

Acknowledgements

We thank the Elixir community members who spontaneously spread this research and interacted with us on our GitHub repository. We also thank the developers who participated in our survey and shared their perspectives about code quality in Elixir. Finally, José Valim deserves particular thanks for facilitating our communication with the Elixir community and supporting the Research with Elixir initiative (http://pesquisecomelixir.com.br/, in Portuguese). This research is supported by a grant from Finbits: https://www.finbits.com.br.

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Lucas Francisco da Matta Vegi.

Ethics declarations

Competing interests

The authors declare that they have no conflict of interest.

Additional information

Communicated by: Mika Mäntylä.

Publisher's Note

Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.

Rights and permissions

Springer Nature or its licensor (e.g. a society or other partner) holds exclusive rights to this article under a publishing agreement with the author(s) or other rightsholder(s); author self-archiving of the accepted manuscript version of this article is solely governed by the terms of such publishing agreement and applicable law.

Reprints and permissions

About this article

Check for updates. Verify currency and authenticity via CrossMark

Cite this article

Francisco da Matta Vegi, L., Valente, M.T. Understanding code smells in Elixir functional language. Empir Software Eng 28, 102 (2023). https://doi.org/10.1007/s10664-023-10343-6

Download citation

  • Accepted:

  • Published:

  • DOI: https://doi.org/10.1007/s10664-023-10343-6

Keywords

Navigation