PL EN


Preferencje help
Widoczny [Schowaj] Abstrakt
Liczba wyników
Tytuł artykułu

Comparing the understandability of iteration mechanisms over Collections in Java

Identyfikatory
Warianty tytułu
Języki publikacji
EN
Abstrakty
EN
Source code understandability is a desirable quality factor affecting long-term code maintenance. Understandability of source code can be assessed in a variety of ways, including subjective evaluation of code fragments (perceived understandability), correctness, and response time to tasks performed. It can also be assessed using various source code metrics, such as cyclomatic complexity or cognitive complexity. Programming languages are evolving, giving programmers new ways to do the same things, e.g., iterating over collections. Functional solutions (lambda expressions and streams) are added to typical imperative constructs like iterators or for-each statements. This research aims to check if there is a correlation between perceived understandability, understandability measured by task correctness, and predicted by source code metrics for typical tasks that require iteration over collections implemented in Java. The answer is based on the results of an experiment. The experiment involved 99 participants of varying ages, declared Java knowledge and seniority measured in years. Functional code was perceived as the most understandable, but only in one case, the subjective assessment was confirmed by the correctness of answers. In two examples with the highest perceived understandability, streams received the worst correctness scores. Cognitive complexity and McCabe's complexity had the lowest values in all tasks for the functional approach, but - unfortunately - they did not correlate with answer correctness. The main finding is that the functional approach to collection manipulation is the best choice for the filter-map-reduce idiom and its alternatives (e.g., filter-only). It should not be used in more complex tasks, especially those with higher complexity metrics.
Rocznik
Strony
19--37
Opis fizyczny
Bibliogr. 16 poz., rys. tab.
Twórcy
  • Wroclaw University of Science and Technology, Wrocław, Poland
  • Wroclaw University of Science and Technology, Wrocław, Poland
Bibliografia
  • [1] Baron, M. M., Wirich, M., Wagner, S.: An Empirical Validation of Cognitive Complexity as a Measure of Source Code Understandability, in Proceedings of the 14thACM/IEEE International Symposium of Empirical Software Engineering and Measurement, p. 1-12, (2020).
  • [2] Bexell, A.: Comparing functional to imperative Java with regards to readability, complexity, and verbosity, Växjö, (2017).
  • [3] Cheon, Y., Escobar De La Torre, A.: Impacts of Java Language Features on the Memory Performances of Android Apps, ScholarWorks@UTEP, Impacts of Java Language Features on the Memory Performances of Android Apps - CORE (2017).
  • [4] Costa, D. E., Andrzejak, A., Seboek, J., Lo, D.: Empirical Study of Usage and Performance of Java Collections, Proceedings of the 8th ACM/SPEC on International Conference on Performance Engineering, (2017).
  • [5] Flauzino, M., Veríssimo, J., Terra, R., Cirilo, E., Durelli, V., Durelli, R.: Are you still smelling it?: A comparative study between Java and Kotlin Language, Proceedings of the VII Brazilian Symposium on Software Components, Architectures, and Reuse, pp. 23-32, (2018).
  • [6] Holst, G., Dobslaw, F.: On the Importance and Shortcomings of Code Readability Metrics: A Case Study on Reactive Programming, ArXiv, abs/2110.15246, (2021).
  • [7] Lucas, W., Bonifácio, R., Dias Canedo, E., Marcílio, D., Lima, F.: Does the Introduction of Lambda Expressions Improve the Comprehension of Java Programs?, Proceedings of the XXXIII Brazilian Symposium on Software Engineering, Association for Computing Machinery, pp. 187-196 (2019).
  • [8] Mazinanian, D., Ketkar, A., Tsantalis, N., Dig, D.: Understanding the use of lambda expressions in Java, Proceedings of the ACM on Programming Languages, vol. 1, pp. 1-31, (2017).
  • [9] Monteiro Mendonça, W. L., Fortes, J., Lopes, F. V., Marcílio, D., De Almeida, R. B., Dias Canedo, E., Lima, F., Saraiva, J.: Understanding the Impact of Introducing Lambda Expressions in Java Programs, Journal of Software Engineering Research and Development, vol. 8, pp. 1-22, (2020).
  • [10] Nanz, S., Furia, C. A.: A Comparative Study of Programming Languages in Rosetta Code, 37th IEEE International Conference on Software Engineering, vol. 1, pp. 778-788, (2015).
  • [11] Nostas, J., Alcocer, J. P. S., Costa, D. E., Bergel, A.: How Do Developers Use the Java Stream API?, In: Computational Science and Its Applications - ICCSA 2021. ICCSA 2021. Lecture Notes in Computer Science, vol. 12955, Springer, Cham, (2021).
  • [12] Oliveira, W., Oliveira, R., Filho, F. C., Fernandes, B., Lima Pinto G. H., Recommending Energy-efficient Java Collections, Proceedings of the 16th International Conference on Mining Software Repositories, (2019).
  • [13] Oracle, Stream (Java SE 17 & JDK 17) – toList(), https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/util/stream/Stream.html#toList()
  • [14] Pankratius, V., Schmidt, F., Garretón, G.: Combining functional and imperative programming for multicore software: An empirical study evaluating Scala and Java, 34th International Conference on Software Engineering, pp. 123-133, (2012).
  • [15] Pantiuchina, J., Lanza, M., Bavota, G., Improving Code: The (Mis)perception of Quality Metrics, IEEE International Conference on Software Maintenance and Evolution, pp. 80-91, (2018).
  • [16] Tanaka, H., Matsumoto, S., Kusumoto, S.: A Study on the Current Status of Functional Idioms in Java, IEICE Transactions on Information and Systems, E102-D(12), pp. 2414-2422, (2019).
Uwagi
Opracowanie rekordu ze środków MEiN, umowa nr SONP/SP/546092/2022 w ramach programu "Społeczna odpowiedzialność nauki" - moduł: Popularyzacja nauki i promocja sportu (2022-2023).
Typ dokumentu
Bibliografia
Identyfikator YADDA
bwmeta1.element.baztech-ec70dd2b-d1b5-4a0c-96b3-1e2f2b37766f
JavaScript jest wyłączony w Twojej przeglądarce internetowej. Włącz go, a następnie odśwież stronę, aby móc w pełni z niej korzystać.