paperbot · PL 论文追踪

全部论文 待读 收藏

P2 A Study on the Pythonic Functional Constructs' Understandability

Pythonic 函数式构造的可理解性研究
ICSE Proceedings of the IEEE/ACM 46th International Conference on Software Engineering2024匹配度 1/10 · 该论文是Python函数式构造可理解性的开发者对照实验,属于人因与软件工程研究,与用户关注静态分析、LLM/Agent、浮点程序分析和贝叶斯程序分析等方向几乎无交集。引用 4 inbox
Cyrine Zid, Fiorella Zampetti, Giuliano Antoniol, Massimiliano Di Penta
crossref: 2026-09-12

AI 速览

一句话:通过209名开发者的对照实验,评估Python函数式构造相比过程式写法在可理解性上的差异与使用建议。

论文关注 Python 中函数式构造(lambda、推导式、map/reduce/filter)是否比过程式写法更难理解。作者开展有 209 名开发者参与的对照实验,要求参与者修改使用/不使用函数式构造的代码,比较不同实现的可理解性,并收集关于何时何地适合使用这些构造的看法。结果发现:含 lambda 的代码片段比过程式替代更易修改,但推导式并非如此;在主观可理解性上,过程式实现被认为比函数式替代更可读。此外,函数式构造虽可写出紧凑代码、有助于可维护性和性能,但被认为难以调试。结论可为函数式构造的教学、质量保证活动优先级和工具支持提供依据。

问题
探究 Python 函数式构造(lambda、推导式、map/reduce/filter)相对于过程式替代方案是否带来可理解性问题。
方法
对 209 名开发者进行对照实验,要求其修改代码、比较不同实现的可理解性,并反馈何时何地适合使用函数式构造。
评估
通过对照实验中的代码修改任务和开发者对可理解性的主观评价,比较函数式与过程式实现的差异。
原文摘要(Abstract)

The use of functional constructs in programming languages such as Python has been advocated to help write more concise source code, improve parallelization, and reduce side effects. Nevertheless, their usage could lead to understandability issues. This paper reports the results of a controlled experiment conducted with 209 developers to assess the understandability of given Pythonic functional constructs---namely lambdas, comprehensions, and map/reduce/-filter functions---if compared to their procedural alternatives. To address the study's goal, we asked developers to modify code using functional constructs or not, to compare the understandability of different implementations, and to provide insights about when and where it is preferable to use such functional constructs. Results of the study indicate that code snippets with lambdas are more straightforward to modify than the procedural alternatives. However, this is not the case for comprehension. Regarding the perceived understandability, code snippets relying on procedural implementations are considered more readable than their functional alternatives. Last but not least, while functional constructs may help write compact code, improving maintainability and performance, they are considered hard to debug. Our results can lead to better education in using functional constructs, prioritizing quality assurance activities, and enhancing tool support for developers.

链接与引用

DOI 原文 · PDF(开放获取) ·

BibTeX
@inproceedings{paperbot11391,
  title = {A Study on the Pythonic Functional Constructs' Understandability},
  author = {Cyrine Zid and Fiorella Zampetti and Giuliano Antoniol and Massimiliano Di Penta},
  booktitle = {ICSE},
  year = {2024},
  doi = {10.1145/3597503.3639211}
}