Dulingo 已完成到 Kotlin 的迁移工作,将代码行数平均减少了 30%
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。

Duolingo 是全球最受欢迎的语言学习平台之一,也是 Google Play 上下载量最大的免费教育应用之一,下载量超过 2 亿。
大多数人学习新语言是为了获得更好的机会,而 Duolingo 的使命是为其超过 3 亿名学习者提供可免费使用的语言学习服务。
他们做了什么

Duolingo 的 Android 开发者发现代码库的代码行数每年增长 46% 之后,一致决定从 Java 迁移至 Kotlin。
该团队发扬了真正的 Duolingo 风格,通过开展每日排行榜竞赛并鼓励学习,让迁移过程充满游戏乐趣。该团队中经验丰富的 Kotlin 开发者担任“Kotlin 检查员”角色,并分享代码审核方面的最佳做法,最终该团队的所有 Android 开发者都成为了 Kotlin 专家。
两年后,该团队完成了迁移工作,代码的可维护性得到显著提升。他们发现,将 Java 文件转换为 Kotlin 文件后,代码行数平均减少了 30%,某些情况下高达 90%。
“总体而言,在迁移到 Kotlin 后,我们非常满意,也很高兴看到 Kotlin 在我们公司和整个软件行业中的使用率不断增长!”- Art Chaidarun,资深高级软件工程师
成果
尽管有了新的产品功能,活跃贡献者的数量增加了一倍以上,但他们的代码库规模几乎与两年前未迁移时一样,这证明这一决策带来了不错的投资收益。此外,内部问卷调查显示他们的 NPS 提升了 129 个点,开发者满意度跃升,开发者认为是采用 Kotlin 起到了主要作用。
语言一直在不断发展,Duolingo 更是如此,也在不断发展壮大。严格的 A/B 测试和应用内反馈可确保该团队不断完善方法并,为全球用户提供优质的语言学习服务。现在,他们的 Android 应用完全使用 Kotlin 代码库,这让他们可以更加放心、高效地开展工作。
开始使用
详细了解使用 Kotlin 开发 Android 应用。
本页面上的内容和代码示例受内容许可部分所述许可的限制。Java 和 OpenJDK 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2020-05-15。
[null,null,["最后更新时间 (UTC):2020-05-15。"],[],[],null,["# Duolingo completes migration to Kotlin and reduces its line count by an average of 30%\n\n[Duolingo](https://play.google.com/store/apps/details?id=com.duolingo&hl=en_US)\nis one of the most popular language learning platforms in the world, and one of\nthe most-downloaded free education apps on Google Play, with more than 200\nmillion downloads.\n\nThe majority of people learn a new language to gain access to better\nopportunities, and it's Duolingo's mission to provide free and accessible\nlanguage education to its 300+ million learners.\n\nWhat they did\n-------------\n\nAfter seeing that their codebase's line count was growing 46% every year, a\nunanimous decision was made by Duolingo's Android developers to migrate from\nJava to Kotlin.\n\nIn true Duolingo style, the team gamified the migration process by running a\ncontest with a daily leaderboard and encouraging learning. The team's\nexperienced Kotlin developers became \"Kotlin checkers\" and shared best practices\nin code reviews, until all the Android developers became Kotlin experts\nthemselves.\n\nAfter two years the migration was complete, [dramatically improving code\nmaintainability](https://blog.duolingo.com/migrating-duolingos-android-app-to-100-kotlin/).\nThey found that **converting a Java file to Kotlin reduced its line count by an\naverage of 30%, and in certain cases by as much as 90%**.\n\n\"Overall we're very happy that we migrated to Kotlin when we did, and we're\nexcited to see its usage continue to grow both within our company and throughout\nthe software industry!\" - Art Chaidarun, Sr. Staff Software Engineer\n\nResults\n-------\n\nDespite having new product features and more than double the number of active\ncontributors, their codebase is nearly the same size as it was before the\nmigration two years ago, proving that the decision was a good investment. What's\nmore, internal surveys show their **developer satisfaction has skyrocketed by\n129 NPS points**, and Kotlin is a major factor cited in responses.\n\nDuolingo is always expanding and evolving, just like languages. [Rigorous A/B\ntesting](https://www.youtube.com/watch?v=xAx0ccvKw-M) and in-app feedback ensure\nthe team will continue to refine methodology and offer the best language\neducation in the world. Now with their Android app having a 100% Kotlin\ncodebase, they can do so with even more confidence and efficacy.\n\nGet started\n-----------\n\nLearn more about [developing an Android app with Kotlin](/kotlin)."]]