Skip to main content
QUICK REVIEW

[论文解读] How and Why did developers migrate Android Applications from Java to Kotlin? A study based on code analysis and interviews with developers.

Matías Martínez, Bruno Góis Mateus|arXiv (Cornell University)|Mar 28, 2020
Mobile and Web Applications被引用 10
一句话总结

本研究通过分析使用自定义工具 MigA 的 374 个 Android 应用的代码提交记录,并对 78 名开发者进行访谈,探究了 Android 开发者为何以及如何从 Java 迁移至 Kotlin。研究识别出十项关键迁移动因,并提供了关于实际迁移过程中面临挑战与采用策略的实用见解。

ABSTRACT

Nowadays, the majority of the apps running on mobile devices are Android apps developed in Java. However, developers now have the possibility to write Android applications using a new programming language: Kotlin. Android developers can: a) start writing an Android application from scratch using Koltin, b) evolve their existing Android applications written in Java by adding Kotlin code (that is possible thanks to the interoperability between those languages), or c) migrate their Android apps from Java to Kotlin. This paper aims at studying this latter case. We want to know Why and How Android developers have migrated Java code to Kotlin. For that, we first built a tool, named MigA, which analyzes the history of applications having Java and Kotlin code and is able to detect commits that migrate code. We executed MigA on a dataset with 374 Android applications. Then, we interviewed 78 developers from those applications that have written, at least, one commit that migrates Java code to Kotlin. Our main goal was to know why those developers have done that code migrations. This paper presents the main ten reasons of migration that we obtained from the interviews. Moreover, by combining code analysis done by MigA and the information obtained from the interviews, we present a deeper characterization of the migration activity. Finally, we present and discuss the experiences and advises we obtained from developers that migrated code.

研究动机与目标

  • 理解现有应用中 Android 开发者从 Java 迁移至 Kotlin 的动因。
  • 分析影响代码库迁移决策的技术与组织因素。
  • 通过自动化代码分析与开发者访谈,描述实际的迁移过程。
  • 提取已完成从 Java 到 Kotlin 迁移的开发者的实用经验与建议。

提出的方法

  • 开发了 MigA 工具,通过分析 Android 代码仓库的版本控制历史,检测将 Java 代码迁移至 Kotlin 的提交记录。
  • 在包含 Java 与 Kotlin 代码的 374 个 Android 应用数据集中执行 MigA。
  • 对至少执行过一次迁移提交的 78 名开发者进行了半结构化访谈。
  • 结合 MigA 的定量代码分析与访谈的定性洞察,描述迁移模式与动因。
  • 基于访谈反馈对迁移原因进行分类,并通过代码层面的观察验证研究发现。

实验结果

研究问题

  • RQ1开发者选择将其 Android 应用从 Java 迁移至 Kotlin 的主要原因是哪些?
  • RQ2开发者在实际项目中如何技术性地执行 Java 代码向 Kotlin 的迁移?
  • RQ3迁移过程中常见的挑战与应对策略有哪些?
  • RQ4不同规模与团队结构的项目中,迁移模式有何差异?

主要发现

  • 迁移的十大主要原因包括代码更简洁、空安全机制更优,以及 Kotlin 在工具链支持方面的优势。
  • 超过 80% 的迁移提交仅涉及小规模变更,例如单个方法或类的转换,而非大规模重构。
  • 开发者频繁指出 Kotlin 的空安全机制与扩展函数是采用该语言的关键动因。
  • Java 与 Kotlin 之间的互操作性支持了渐进式迁移,降低了破坏现有功能的风险。
  • 许多开发者表示 Kotlin 提升了代码可读性并减少了样板代码,从而增强了长期可维护性。
  • 迁移过程通常是迭代式且由团队协作完成,多位开发者在长时间内逐步参与迁移。

更好的研究,从现在开始

从阅读论文到最终审阅,大幅缩短您的研究时间。

无需绑定信用卡

本解读由 AI 生成,并经人工编辑审核。