Use este identificador para citar ou linkar para este item:
https://repositorio.ufpe.br/handle/123456789/46446
Compartilhe esta página
Título: | On the usage of functional programming concepts in JavaScript programs |
Autor(es): | ALVES, Fernando Henrique de Albuquerque |
Palavras-chave: | Engenharia de software; Programação funcional; Javascript |
Data do documento: | 8-Jul-2022 |
Editor: | Universidade Federal de Pernambuco |
Citação: | ALVES, Fernando Henrique de Albuquerque. On the usage of functional programming concepts in JavaScript programs. 2022. Dissertação (Mestrado em Ciência da Computação) - Universidade Federal de Pernambuco, Recife, 2022. |
Abstract: | Language constructs inspired by functional programming have made their way into most mainstream programming languages. Many researchers and developers consider that these constructs lead to programs that are more concise, reusable, and easier to under- stand. Notwithstanding, few studies investigate the prevalence of these structures and the implications of using them in mainstream programming languages. This paper quanti- fies the prevalence of four concepts typically associated with functional programming in JavaScript: recursion, immutability, lazy evaluation, and functions as values. We divide the latter into two groups, higher-order functions and callbacks & promises. We focus on JavaScript programs due to the availability of some of these concepts in the language since its inception, its inspiration from functional programming languages, and its pop- ularity. We mine 91 GitHub repositories (more than 22 million LOC) written mostly in JavaScript (over 50% of the code), measuring the usage of these concepts from both static and temporal perspectives. We also measure the likelihood of bug-fixing commits remov- ing uses of these concepts (which would hint at bug-proneness) and their association with the presence of code comments (which would hint at code that is hard to understand). We find that these concepts are in widespread use (478,605 occurrences, 1 for every 46.65 lines of code, 43.59% of LOC). In addition, the usage of higher-order functions, immutabil- ity, and lazy evaluation-related structures has been growing throughout the years for the analyzed projects, while the usage of recursion and callbacks & promises has decreased. We also find statistical evidence that removing these structures, with the exception of the ones associated to immutability, is less common in bug-fixing commits than in other commits. In addition, their presence is not correlated with comment size. Our findings suggest that functional programming concepts are important for developers using a multi- paradigm language such as JavaScript, and their usage does not make programs harder to understand. |
URI: | https://repositorio.ufpe.br/handle/123456789/46446 |
Aparece nas coleções: | Dissertações de Mestrado - Ciência da Computação |
Arquivos associados a este item:
Arquivo | Descrição | Tamanho | Formato | |
---|---|---|---|---|
DISSERTAÇÃO Fernando Henrique de Albuquerque Alves.pdf | 818,06 kB | Adobe PDF | ![]() Visualizar/Abrir |
Este arquivo é protegido por direitos autorais |
Este item está licenciada sob uma Licença Creative Commons