Twitter: Kotlin で開発者の生産性とコードの信頼性を向上
コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。

Twitter は、広く使用されているソーシャル メディア プラットフォームの 1 つで、ユーザーはここで何が起こっているのかをいつでも知ることができます。同社のエンジニアリング チームは、Kotlin の null 安全性機能を利用してコードベースのメンテナンス性および Android アプリの信頼性を高めることを目標に掲げ、2017 年に Kotlin を導入しました。
Twitter の取り組み
チームはまず Periscope のコードベースと Twitter アプリの Periscope 機能に Kotlin を導入し、Kotlin を使用する長所と短所をテストしました。チームは生産性とコードの信頼性の向上に感銘を受け、Twitter アプリの他の機能にも Kotlin を段階的に追加していきました。
Kotlin のおかげで、Twitter はアプリのコード量を削減し、ボイラープレートのメンテナンスを最小限に抑え、チームの生産性を向上させることができました。データクラス、シールクラス、デフォルト パラメータなどの言語機能を使用することで、コードの記述量を減らすとともにコードの作成時間を短縮しました。また、Kotlin のスマート キャストにより、チームが作成およびメンテナンスする必要があるコードの量も削減されました。
「Kotlin は使っていて楽しい言語です。ボイラープレートの削減により、作成しなければならないコードの量が少なくなります。」- Andy Fox 氏(Twitter 社シニア ソフトウェア エンジニア)
Kotlin の null 安全性機能により、Twitter のコードの信頼性も向上しました。チームが Kotlin を導入した初期段階で、以前は検出されなかった潜在的な障害が発見されました。コンパイル時の null チェックにより、チームは問題を早期に検出し、null 可能性エラーをプロアクティブに処理できるようになりました。
結果
Kotlin の導入後、チームが継続的に観測しているシステムの健全性とパフォーマンスは良好な状態が続いています。それとともに、チームは実行時ではなくコンパイル時に重大なエラーを検出することで、チームの生産性とアプリの安全性を高めています。生産性とコードの信頼性が向上したことを受けて、チームはフリート、DM リアクション、リストなど、多くの新機能を Kotlin で作成することにしました。
始める
詳細については、Kotlin で Android アプリを開発するをご覧ください。
このページのコンテンツやコードサンプルは、コンテンツ ライセンスに記載のライセンスに従います。Java および OpenJDK は Oracle および関連会社の商標または登録商標です。
最終更新日 2020-10-21 UTC。
[[["わかりやすい","easyToUnderstand","thumb-up"],["問題の解決に役立った","solvedMyProblem","thumb-up"],["その他","otherUp","thumb-up"]],[["必要な情報がない","missingTheInformationINeed","thumb-down"],["複雑すぎる / 手順が多すぎる","tooComplicatedTooManySteps","thumb-down"],["最新ではない","outOfDate","thumb-down"],["翻訳に関する問題","translationIssue","thumb-down"],["サンプル / コードに問題がある","samplesCodeIssue","thumb-down"],["その他","otherDown","thumb-down"]],["最終更新日 2020-10-21 UTC。"],[],[],null,["# Twitter increases developer productivity and code reliability with Kotlin\n\n[Twitter](https://play.google.com/store/apps/details?id=com.twitter.android&hl=en)\nis one of the most widely used social media platforms where users can see what's\nhappening in the world at any given moment.\nThe engineering team introduced Kotlin in 2017 with the goal of making their\ncodebase more maintainable and their Android app more reliable as a result of\nKotlin's [null safety features](/kotlin/common-patterns#nullability).\n\nWhat they did\n-------------\n\nThe team initially introduced Kotlin into [Periscope](https://play.google.com/store/apps/details?id=tv.periscope.android&referrer)'s\ncodebase and into the Periscope feature of the Twitter app, and were able to\ntest the benefits and tradeoffs of using Kotlin. Impressed with the improvements\nto productivity and code reliability, they gradually began adding Kotlin to\nother features of the Twitter app.\n\nKotlin has helped Twitter decrease the amount of code in their app,\nminimizing boilerplate maintenance and **enabling the team to be more\nproductive.** They used language features such as data classes, sealed\nclasses, and default parameters, which allowed them to be able to write less\ncode, and faster. Kotlin's smart casting has also reduced the amount of code\ntheir team needs to write and maintain.\n\n*\"Kotlin is a joy to use. The reduction in boilerplate reduces the amount of\ncode we need to write.\" - Andy Fox, Senior Software Engineer at Twitter*\n\nKotlin's null safety features have also increased Twitter's code reliability.\nInitially when the team introduced Kotlin, they uncovered silent failures that\nhad previously gone undetected. Compile time null checking allows the team to\n**detect issues sooner, and handle nullability errors more\nproactively.**\n\nResults\n-------\n\nAfter adopting Kotlin, the team has continued to see excellent system health\nand performance for their app. At the same time, they've improved their team's\nproductivity and made their app safer by catching critical errors at compile\ntime instead of runtime. With the increases in productivity and code\nreliability, the team has decided to write many new features such as Fleets,\nDM Reactions, and Lists in Kotlin.\n\nGet started\n-----------\n\nLearn more about [developing an Android app with Kotlin](/kotlin)."]]