首页> 外文期刊>Journal of Software Engineering Research and Development >Understanding the Impact of Introducing Lambda Expressions in Java Programs
【24h】

Understanding the Impact of Introducing Lambda Expressions in Java Programs

机译:了解在Java计划中引入Lambda表达式的影响

获取原文
           

摘要

Background: The Java programming language version eight introduced several features that encourage the functional style of programming, including the support for lambda expressions and the Stream API. Currently, there is common wisdom that refactoring legacy code to introduce lambda expressions, besides other potential benefits, simplifies the code and improves program comprehension. Aims: The purpose of this work is to investigate this belief, conducting an in-depth study to evaluate the effect of introducing lambda expressions on program comprehension. Method: We conduct this research using a mixed-method study. For the quantitative method, we quantitatively analyze 166 pairs of code snippets extracted directly either from GitHub or from recommendations from three tools (RJTL, NetBeans, and IntelliJ). We also surveyed practitioners to collect their perceptions about the benefits on program comprehension when introducing lambda expressions. We asked practitioners to evaluate and rate sets of pairs of code snippets. Results: We found contradictory results in our research. Based on the quantitative assessment, we could not find evidence that the introduction of lambda expressions improves software readability—one of the components of program comprehension. Our results suggest that the transformations recommended by the aforementioned tools decrease program comprehension when assessed by two state-of-the-art models to estimate readability. Differently, our findings of the qualitative assessment suggest that the introduction of lambda expression improves program comprehension in three scenarios: when we convert anonymous inner classes to a lambda expression, structural loops with inner conditional to a anyMatch operator, and structural loops to filter operator combined with a collect method. Implications: We argue in this paper that one can improve program comprehension when she applies particular transformations to introduce lambda expressions (e.g., replacing anonymous inner classes with lambda expressions). Also, the opinion of the participants shines the opportunities in which a transformation for introducing lambda might be advantageous. This might support the implementation of effective tools for automatic program transformations.
机译:背景:Java编程语言版本8介绍了若干鼓励功能的若干功能,包括对Lambda表达式和流API的支持。目前,除了其他潜在的好处,还有常见的智慧来改进遗留代码,以引入Lambda表达式,简化了代码并提高了计划理解。目的:这项工作的目的是调查这种信念,进行深入研究,以评估引入Lambda表达对方案理解的影响。方法:我们使用混合方法研究进行这项研究。对于定量方法,我们定量分析了直接从GitHub中提取的166对代码片段,或者从三个工具(RJTL,NetBeans和Intellij)中提取的建议。我们还调查了从业人员在引入林类表达时对计划理解的益处的看法。我们询问从业者评估和评估一组代码片段。结果:我们发现矛盾的结果在我们的研究中。根据定量评估,我们找不到证据表明Lambda表达的引入改善了软件可读性 - 程序理解的组件之一。我们的研究结果表明,在通过两个最先进的模型评估以估算可读性时,上述工具推荐的转型降低了计划理解。不同,我们的定性评估结果表明,Lambda表达的引入在三种情况下提高了方案理解:当我们将匿名内部类转换为Lambda表达时,带有内部条件的结构环,以及滤波器组合的结构环用收集方法。含义:我们在本文中争辩说,当她应用特定变换以引入lambda表达式时,可以提高程序理解(例如,用Lambda表达式替换匿名内部类)。此外,参与者的意见派出了引入林达的转型可能是有利的机会。这可能支持实现自动程序转换的有效工具。

著录项

相似文献

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

客服邮箱:kefu@zhangqiaokeyan.com

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

  • 服务号