Polymorphic types are an important feature in most strongly typed programming languages. They allow functions to be written in a way that can be used with different data types, while still enforcing the relationship and constraints between the values. However, programmers often find polymorphic types difficult to use and understand and tend to reason using concrete types. We propose GeckoGraph, a graphical notation for types. GeckoGraph aims to accompany traditional text-based type notation and to make reading, understanding, and comparing types easier. We conducted a large-scale human study using GeckoGraph compared to text-based type notation. To our knowledge, this is the largest controlled user study on functional programming ever conducted. The results of the study show that GeckoGraph helps improve programmers' ability to succeed in the programming tasks we designed, especially for novice programmers.
翻译:多态类型是大多数强类型编程语言中的重要特性。它允许函数以可适用于不同数据类型的方式进行编写,同时仍能强制执行值之间的关系与约束。然而,程序员常觉得多态类型难以使用和理解,并倾向于使用具体类型进行推理。我们提出了GeckoGraph——一种类型的图形化表示法。GeckoGraph旨在辅助传统的基于文本的类型表示法,使类型的阅读、理解和比较更加容易。我们开展了一项大规模的人体研究,将GeckoGraph与基于文本的类型表示法进行对比。据我们所知,这是有史以来关于函数式编程规模最大的受控用户研究。研究结果表明,GeckoGraph有助于提高程序员在我们设计的编程任务中的成功能力,尤其是对新手程序员而言。