arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2602.04824cs.SE
收藏

开发者是否阅读类型信息?一项关于TypeScript的注视研究

Do Developers Read Type Information? An Eye-Tracking Study on TypeScript

Dakota State University(达科他州立大学);University of Nebraska-Lincoln(内布拉斯加大学林肯分校)

Samuel W. Flint, Robert Dyer, Bonita Sharif

AI总结:

本研究通过注视实验发现,开发者在TypeScript代码摘要和bug定位任务中并未频繁阅读类型注解,揭示了类型注解在开发实践中的实际使用情况。

摘要:

静态注释的类型已被证明在许多编程任务中帮助开发者,即使在不使用静态类型检查的情况下,这种益处仍然成立。假设这是因为开发者将类型注解用作代码中的文档。在本研究中,我们旨在提供证据,证明开发者将类型注解用作代码中的文档。理解这种假设的使用将有助于了解开发者如何以及在什么情况下使用类型信息;此外,它可能有助于设计更好的开发工具,并影响教育决策。为了提供这种证据,我们对26名本科生进行了注视研究,以确定他们在TypeScript语言中进行代码摘要和bug定位任务时是否阅读类型注解。我们发现,当类型注解或类型声明存在时,开发者在代码摘要或bug定位任务中并不更频繁地直接注视包含类型注解的行。这些结果对工具构建者改进类型信息的可用性、开发社区建立良好的类型注解使用标准以及教育界强制实施阅读模式的有教育意义。

英文摘要:

Statically-annotated types have been shown to aid developers in a number of programming tasks, and this benefit holds true even when static type checking is not used. It is hypothesized that this is because developers use type annotations as in-code documentation. In this study, we aim to provide evidence that developers use type annotations as in-code documentation. Understanding this hypothesized use will help to understand how, and in what contexts, developers use type information; additionally, it may help to design better development tools and inform educational decisions. To provide this evidence, we conduct an eye tracking study with 26 undergraduate students to determine if they read type annotations during code comprehension and bug localization in the TypeScript language. We found that developers do not look directly at lines containing type annotations or type declarations more often when they are present, in either code summarization or bug localization tasks. The results have implications for tool builders to improve the availability of type information, the development community to build good standards for use of type annotations, and education to enforce deliberate teaching of reading patterns.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑