Learning and Programming Challenges of Rust: A Mixed-Methods Study

Learning and Programming Challenges of Rust: A Mixed-Methods Study
复制标题

DOI:
10.1145/3510003.3510164
复制
发表时间:
2022-05
期刊:
2022 IEEE/ACM 44th International Conference on Software Engineering (ICSE)
影响因子:
--
通讯作者:
Shuofei Zhu;Ziyi Zhang;Boqin Qin;Aiping Xiong;Linhai Song
Shuofei Zhu;Ziyi Zhang;Boqin Qin;Aiping Xiong;Linhai Song
中科院分区:
其他
文献类型:
--
作者:
Shuofei Zhu;Ziyi Zhang;Boqin Qin;Aiping Xiong;Linhai Song

文献摘要

相似文献

Rust 是一种年轻的系统编程语言,旨在提供高级语言的安全保证和低级语言的执行性能。为了实现这一设计目标,Rust 提供了一套安全规则,并在编译时根据这些规则进行检查,以消除许多内存安全和线程安全问题。由于其安全性和性能,Rust 近年来大受欢迎,已被用于构建许多安全关键型软件系统。了解 Rust 安全规则带来的学习和编程挑战至关重要。为此,我们首先对 100 个与 Rust 相关的 Stack Overflow 问题进行了仔细的人工检查,从而开展了一项实证研究。我们试图了解:(1) 哪些安全规则对学习和编程具有挑战性;(2) 在哪些情况下安全规则更难应用;(3) Rust 编译器在调试违反安全规则的情况时是否提供了足够的帮助。随后,我们对 101 名 Rust 程序员进行了在线调查,以验证实证研究的结果。我们邀请参与者对程序变体进行评估,这些程序变体在违反安全规则或涉及违反安全规则的代码结构方面彼此不同,我们还比较了参与者在这些变体上的表现。我们的混合方法调查揭示了一系列一致的结论,这些结论对拉斯特语言学习者、从业人员和语言设计者都有裨益。
Rust is a young systems programming language designed to provide both the safety guarantees of high-level languages and the execution performance of low-level languages. To achieve this design goal, Rust provides a suite of safety rules and checks against those rules at the compile time to eliminate many memory-safety and thread-safety issues. Due to its safety and performance, Rust's popularity has increased significantly in recent years, and it has already been adopted to build many safety-critical software systems. It is critical to understand the learning and programming challenges imposed by Rust's safety rules. For this purpose, we first conducted an empirical study through close, manual inspection of 100 Rust-related Stack Overflow questions. We sought to understand (1) what safety rules are challenging to learn and program with, (2) under which contexts a safety rule becomes more difficult to apply, and (3) whether the Rust compiler is sufficiently helpful in debugging safety-rule violations. We then performed an online survey with 101 Rust programmers to validate the findings of the empirical study. We invited participants to evaluate program variants that differ from each other, either in terms of violated safety rules or the code constructs involved in the violation, and compared the participants' performance on the variants. Our mixed-methods investigation revealed a range of consistent findings that can benefit Rust learners, practitioners, and language designers.