比较Java中集合迭代机制的可理解性

IF 1.8 Q3 COMPUTER SCIENCE, ARTIFICIAL INTELLIGENCE Foundations of Computing and Decision Sciences Pub Date : 2023-03-01 DOI:10.2478/fcds-2023-0002
B. Hnatkowska, Bartosz Krych
{"title":"比较Java中集合迭代机制的可理解性","authors":"B. Hnatkowska, Bartosz Krych","doi":"10.2478/fcds-2023-0002","DOIUrl":null,"url":null,"abstract":"Abstract 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.","PeriodicalId":42909,"journal":{"name":"Foundations of Computing and Decision Sciences","volume":"48 1","pages":"19 - 37"},"PeriodicalIF":1.8000,"publicationDate":"2023-03-01","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"0","resultStr":"{\"title\":\"Comparing the understandability of iteration mechanisms over Collections in Java\",\"authors\":\"B. Hnatkowska, Bartosz Krych\",\"doi\":\"10.2478/fcds-2023-0002\",\"DOIUrl\":null,\"url\":null,\"abstract\":\"Abstract 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.\",\"PeriodicalId\":42909,\"journal\":{\"name\":\"Foundations of Computing and Decision Sciences\",\"volume\":\"48 1\",\"pages\":\"19 - 37\"},\"PeriodicalIF\":1.8000,\"publicationDate\":\"2023-03-01\",\"publicationTypes\":\"Journal Article\",\"fieldsOfStudy\":null,\"isOpenAccess\":false,\"openAccessPdf\":\"\",\"citationCount\":\"0\",\"resultStr\":null,\"platform\":\"Semanticscholar\",\"paperid\":null,\"PeriodicalName\":\"Foundations of Computing and Decision Sciences\",\"FirstCategoryId\":\"1085\",\"ListUrlMain\":\"https://doi.org/10.2478/fcds-2023-0002\",\"RegionNum\":0,\"RegionCategory\":null,\"ArticlePicture\":[],\"TitleCN\":null,\"AbstractTextCN\":null,\"PMCID\":null,\"EPubDate\":\"\",\"PubModel\":\"\",\"JCR\":\"Q3\",\"JCRName\":\"COMPUTER SCIENCE, ARTIFICIAL INTELLIGENCE\",\"Score\":null,\"Total\":0}","platform":"Semanticscholar","paperid":null,"PeriodicalName":"Foundations of Computing and Decision Sciences","FirstCategoryId":"1085","ListUrlMain":"https://doi.org/10.2478/fcds-2023-0002","RegionNum":0,"RegionCategory":null,"ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"Q3","JCRName":"COMPUTER SCIENCE, ARTIFICIAL INTELLIGENCE","Score":null,"Total":0}
引用次数: 0

摘要

摘要源代码的可理解性是影响长期代码维护的理想质量因素。源代码的可理解性可以通过多种方式进行评估,包括对代码片段(感知的可理解性)、正确性和执行任务的响应时间的主观评估。还可以使用各种源代码度量来评估它,例如圈复杂度或认知复杂度。编程语言在不断发展,为程序员提供了做同样事情的新方法,例如,遍历集合。函数式解决方案(lambda表达式和流)被添加到典型的命令式结构中,如迭代器或for-each语句。这项研究的目的是检查感知的可理解性、由任务正确性度量的可理解性,以及需要对Java实现的集合进行迭代的典型任务的源代码度量所预测的可理解性之间是否存在相关性。答案是基于一项实验的结果。实验涉及99名不同年龄的参与者,他们的Java知识和年资都不同。功能代码被认为是最容易理解的,但只有在一种情况下,主观评价被答案的正确性所证实。在两个可理解性最高的例子中,流的正确性得分最低。认知复杂性和McCabe的复杂性在功能方法的所有任务中都是最低的,但不幸的是,它们与答案的正确性没有关联。主要发现是,对于filter-map-reduce习语及其替代品(例如,filter-only)来说,集合操作的函数式方法是最佳选择。它不应该用于更复杂的任务,特别是那些具有更高复杂性指标的任务。
本文章由计算机程序翻译,如有差异,请以英文原文为准。
查看原文
分享 分享
微信好友 朋友圈 QQ好友 复制链接
本刊更多论文
Comparing the understandability of iteration mechanisms over Collections in Java
Abstract 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.
求助全文
通过发布文献求助,成功后即可免费获取论文全文。 去求助
来源期刊
Foundations of Computing and Decision Sciences
Foundations of Computing and Decision Sciences COMPUTER SCIENCE, ARTIFICIAL INTELLIGENCE-
CiteScore
2.20
自引率
9.10%
发文量
16
审稿时长
29 weeks
期刊最新文献
A DNA Algorithm for Calculating the Maximum Flow of a Network Traceability of Architectural Design Decisions and Software Artifacts: A Systematic Mapping Study Traveling salesman problem parallelization by solving clustered subproblems Towards automated recommendations for drunk driving penalties in Poland - a case study analysis in selected court Designing a Tri-Objective, Sustainable, Closed-Loop, and Multi-Echelon Supply Chain During the COVID-19 and Lockdowns
×
引用
GB/T 7714-2015
复制
MLA
复制
APA
复制
导出至
BibTeX EndNote RefMan NoteFirst NoteExpress
×
×
提示
您的信息不完整,为了账户安全,请先补充。
现在去补充
×
提示
您因"违规操作"
具体请查看互助需知
我知道了
×
提示
现在去查看 取消
×
提示
确定
0
微信
客服QQ
Book学术公众号 扫码关注我们
反馈
×
意见反馈
请填写您的意见或建议
请填写您的手机或邮箱
已复制链接
已复制链接
快去分享给好友吧!
我知道了
×
扫码分享
扫码分享
Book学术官方微信
Book学术文献互助
Book学术文献互助群
群 号:481959085
Book学术
文献互助 智能选刊 最新文献 互助须知 联系我们:info@booksci.cn
Book学术提供免费学术资源搜索服务,方便国内外学者检索中英文文献。致力于提供最便捷和优质的服务体验。
Copyright © 2023 Book学术 All rights reserved.
ghs 京公网安备 11010802042870号 京ICP备2023020795号-1