Modern programming languages, such as Python, support language features from several paradigms, such as object-oriented, procedural, and functional. Research has shown that code written in some paradigms can be harder to comprehend, but to date, no research has looked at which paradigm-specific language features impact comprehension. To this end, this study seeks to uncover which paradigm-specific features impactcomprehension and debugging of code or how multi-paradigm code might affect a developer's ability to do so. We present an exploratory empirical eye-tracking study to investigate 1) how developers classify the predominant paradigm in Python code and 2) how the paradigm affects their ability to debug Python code. The goal is to uncover if specific language features are looked at more often while classifying and debugging code with a predominant paradigm. Twenty-nine developers (primarily students) were recruited for the study and were each given four classification and four debugging tasks in Python. Eye movements were recorded during all the tasks. The results indicate confusion in labeling Functional and Procedural paradigms, but not Object-Oriented. The code with predominantly functional paradigms also took the longest to complete. Changing the predominant paradigm did not affect the ability to debug the code, though developers did rate themselves with lower confidence for Functional code. We report significant differences in reading patterns during debugging, especially in the Functional code. During classification, results show that developers do not necessarily read paradigm-relevant token types.
翻译:现代编程语言(如Python)支持多种范式的语言特性,例如面向对象、过程式和函数式。研究表明,某些范式编写的代码可能更难理解,但迄今为止,尚无研究探讨哪些特定范式的语言特性会影响理解。为此,本研究旨在揭示哪些范式特定特性影响代码的理解与调试,或多范式代码如何影响开发者执行这些任务的能力。我们开展了一项探索性实证眼动追踪研究,以探究:1) 开发者如何分类Python代码中的主导范式;2) 范式如何影响他们调试Python代码的能力。目标是揭示在分类和调试具有主导范式的代码时,特定语言特性是否被更频繁地关注。研究招募了29名开发者(主要为学生),每人完成四项Python代码分类任务和四项调试任务。所有任务期间均记录了眼动数据。结果表明,参与者在区分函数式与过程式范式时存在混淆,但对面向对象范式则无此问题。以函数式范式为主的代码完成耗时最长。改变主导范式并未影响代码调试能力,但开发者对函数式代码的自评信心较低。我们报告了调试过程中阅读模式的显著差异,尤其在函数式代码中。在分类任务中,结果显示开发者未必会阅读与范式相关的特定标记类型。