Anecdotal evidence of cannabis use by professional programmers abounds. Recent studies have found that some professionals regularly use cannabis while programming even for work-related tasks. However, accounts of the impacts of cannabis on programming vary widely and are often contradictory. For example, some programmers claim that it impairs their ability to generate correct solutions while others claim it enhances creativity and focus. There remains a need for an empirical understanding of the true impacts of cannabis on programming. This paper presents the first controlled observational study of the effects of cannabis on programming ability. Based on a within-subjects design with over 70 participants, we find that at ecologically valid dosages, cannabis significantly impairs programming performance. Programs implemented while high contain more bugs and take longer to write (p < 0.05), a small to medium effect (0.22 <= d <= 0.44). We also did not find any evidence that high programmers generate more divergent solutions. However, programmers can accurately assess differences in their programming performance (r = 0.59), even when under the influence of cannabis. We hope that this research will facilitate evidence-based policies and help developers make informed decisions regarding cannabis use while programming.
翻译:关于专业程序员使用大麻的轶事证据比比皆是。近期研究发现,部分专业人士在编程时(甚至处理工作任务时)会定期使用大麻。然而,大麻对编程的影响众说纷纭且常自相矛盾——例如,有程序员声称大麻损害其产出正确解决方案的能力,另有人则认为它能增强创造力和专注力。因此,仍需通过实证研究理解大麻对编程的真实影响。本文首次通过受控观察性研究,探究大麻对编程能力的影响。基于70余名被试的受试者内设计,我们发现:在生态有效剂量下,大麻显著削弱编程表现——受大麻影响时编写的程序存在更多错误且耗时更长(p < 0.05),效应量介于小到中等之间(0.22 <= d <= 0.44)。我们亦未发现受大麻影响的程序员能产生更多发散性解法的证据。但程序员即使在大麻影响下,仍能准确评估自身编程表现的差异(r = 0.59)。我们期望本研究能推动基于证据的政策制定,并帮助开发者就编程期间使用大麻作出知情决策。