首页> 外文期刊>Empirical Software Engineering >Programmers do not favor lambda expressions for concurrent object-oriented code
【24h】

Programmers do not favor lambda expressions for concurrent object-oriented code

机译:程序员不赞成使用lambda表达式来处理并发的面向对象的代码

获取原文
获取原文并翻译 | 示例
获取外文期刊封面目录资料

摘要

Lambda expressions have long been state-of-the-art in the functional programming paradigm. Especially with regard to the use of higher-order functions, they provide developers with a means of defining predicate or projection functions locally, which greatly increases the comprehensibility of the resulting source code. This benefit has motivated language designers to also incorporate lambda expressions into object-oriented (OO) programming languages. In particular, they are claimed to facilitate concurrent programming. One likely reason for this assumption is their purity: pure lambda expressions are free of side effects, and therefore cannot cause, e.g., race conditions. In this paper, we present the first empirical analysis of whether or not this claim is true for OO projects. For this purpose, we investigated the application of lambda expressions in 2923 open-source projects, implemented in one of the most common OO programming languages: C#, C++, and Java. We present three major findings. First, the majority of lambda expressions are not applied in concurrent code and most concurrent code does not make use of lambda expressions. Second, for all three of the languages, we observed that developers compromise their code by applying a significantly higher number of impure, capturing lambda expressions, which are capable of causing race conditions. Finally, we explored further use cases of lambda expressions and found out that testing, algorithmic implementation, and UI are far more common use-cases for the application of lambda expressions. Our results encourage to investigate in more detail the reasons that hinder programmers to apply lambda expressions in concurrent programming and to support developers, e.g., by providing automatic refactorings.
机译:Lambda表达式长期以来一直是函数式编程范例中的最新技术。特别是在使用高阶函数方面,它们为开发人员提供了一种在本地定义谓词或投影函数的方法,这大大提高了所得源代码的可理解性。这种好处促使语言设计人员也将lambda表达式合并到面向对象(OO)的编程语言中。特别地,它们被要求促进并发编程。这种假设的一个可能的原因是它们的纯度:纯lambda表达式没有副作用,因此不会引起例如竞争条件。在本文中,我们提供了关于此声明是否适用于OO项目的第一个实证分析。为此,我们研究了lambda表达式在2923个开源项目中的应用,这些项目以最常见的OO编程语言之一(C#,C ++和Java)实现。我们提出了三个主要发现。首先,大多数lambda表达式未应用在并发代码中,并且大多数并发代码未使用lambda表达式。其次,对于所有三种语言,我们观察到开发人员通过应用大量不纯的,捕获能够引起竞争条件的lambda表达式来破坏代码。最后,我们进一步研究了lambda表达式的用例,发现对于lambda表达式的应用,测试,算法实现和UI是更为常见的用例。我们的结果鼓励更详细地研究阻碍程序员在并行编程中应用lambda表达式并例如通过提供自动重构来支持开发人员的原因。

著录项

相似文献

  • 外文文献
  • 中文文献
  • 专利
获取原文

客服邮箱:kefu@zhangqiaokeyan.com

京公网安备:11010802029741号 ICP备案号:京ICP备15016152号-6 六维联合信息科技 (北京) 有限公司©版权所有
  • 客服微信

  • 服务号