Monzo は Compose を使用して堅牢で高品質のアプリを構築
コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
Monzo は、デジタル金融サービスを提供する銀行およびアプリです。同社の使命は、すべての人のためにお金を役立てることです。Monzo のデザイン システムはマテリアル デザインから逸脱し始めていたため、常に進化するカスタム コンポーネントを簡単に作成して維持する方法が必要でした。そこで、Jetpack Compose を選択しました。
Ultimate Guitar の取り組み
Compose では、マテリアル デザイン コンポーネントはデザイン システムに依存しない基盤 API のレイヤとして提供されます。Monzo は、基盤となる API を使用して、マテリアル コンポーネントを参照しながら独自のコンポーネント ライブラリを構築しました。最初は 1 つの画面ずつ移行し、今ではすべての新しい画面で Compose を使用しています。現在、すべての Android エンジニアが本番環境で Compose を使用しています。「大きな問題は発生しなかったので、一部の新しい機能で使い始め、最終的にはすべての新しい機能で使うことに自信を持つことができました。」
結果
Monzo チームは、新しい画面を簡単に構築できるコンポーネントを作成しました。「すぐに使用できるコンポーネントにより、Compose を学習しながら画面を構築する作業がはるかにスムーズになりました。スロットベースの API は、多くの小さなビルディング ブロックから大きなコンポーネントを簡単に構築できる優れたパターンです。」
Compose を使用することで、Monzo チームは高品質のアプリを構築し、以前はスプリントで実現できなかった魅力的な機能を追加することができました。「たとえば、アニメーションです。Compose ではアニメーションを簡単に追加できるため、色、サイズ、高度の変化などのアニメーションを実装しない理由がほとんどありません。このような「あると便利な」アニメーションは、View システムでは労力と複雑さに見合わないことがよくあります。」
コードが短くなり、読みやすく、理解しやすく、保守しやすくなりました。「宣言型コードは、可変 UI 階層を操作するコードよりも推論がはるかに容易です。すべてのコードが同じ言語で記述され、多くの場合は同じファイルに格納されるので、Kotlin と XML の間を行ったり来たりするより、コードをトレースするのがはるかに簡単になります。XML のテーマとスタイルについては、まだ説明していません。Compose では、テーマ設定が非常にわかりやすくなっています。テーマは定義したプロパティのみで構成され、値はデバイス間で一貫しています。また、Kotlin で記述されているため、IDE での検索と追跡が非常に簡単です。」
Compose を使用することで、Monzo チームはアプリを簡単にテストし、アプリのアクセシビリティを確保できるようになりました。「Compose を使用することで、テストの脆弱性を減らし、確実に実行し、アプリがユーザーの手元で実際に動作するという確信を深めることができました。セマンティクス システムを通じてテストすることで、画面が少なくともデフォルトで合理的にアクセス可能であることを確認できます。」
始める
詳しくは、Compose をご覧ください。
このページのコンテンツやコードサンプルは、コンテンツ ライセンスに記載のライセンスに従います。Java および OpenJDK は Oracle および関連会社の商標または登録商標です。
最終更新日 2021-07-28 UTC。
[null,null,["最終更新日 2021-07-28 UTC。"],[],[],null,["[Monzo](https://monzo.com/) is a bank and app offering\ndigital financial services. Their mission is to make money work\nfor everyone. Monzo's design system started to deviate from Material Design so\nthey wanted an **easy way to write and maintain custom components** that are\nconstantly evolving---so they chose Jetpack Compose.\n\nWhat they did\n\nWith Compose the Material Design components are provided as a layer over the\ndesign-system-agnostic foundation APIs. Monzo used the foundation APIs to build\ntheir own component library, using the Material components as reference. They\nstarted by migrating a screen at a time, now using Compose in all new screens.\nNow, Compose is used in production, by all of the Android engineers: *\"We\ndidn't encounter any major problems, and so we felt confident enough to start\nusing it for some select new features, and eventually for all new features.\"*\n\nResults\n\nThe Monzo team created components that enable them to easily build new\nscreens: *\"The components we provide out of the box make building a screen\nwhile learning Compose a **much smoother experience**. The slot-based APIs is a\nfantastic pattern that makes it really easy for us to build larger components\nout of lots of small building blocks.\"*\n\nWith Compose, the Monzo team were able to build a higher quality app, adding\ndelightful features that previously they couldn't get to in their\nsprints: *\"One example is animations - they're so easy to add in Compose that\n**there's very little reason not to animate things** like color/size/elevation\nchanges. These 'nice to have' animations are often too difficult to be worth\nthe effort and complexity in the View system.\"*\n\nTheir code is now shorter, and it's easier to read, understand, and\nmaintain: *\"Declarative code is **much easier to reason about** than code that\nmanipulates a mutable UI hierarchy. It's also much **easier to trace through code**\nwhen it's all written in the same language and often the same file, rather than\njumping back and forth between Kotlin and XML. Don't even get me started on XML\nthemes and styles! **Theming is a lot easier to understand** in Compose. Our theme\nonly consists of the properties we define, the values are consistent across\ndevices, and because it's in Kotlin it is really easy to search and follow in\nthe IDE.\"*\n\nCompose allowed the Monzo team to easily test their app and ensure their app is\naccessible: *\"It's helped us **write tests that are less fragile, run reliably,\nand give us a lot of confidence** that our app actually works in the hands of our\nusers. Testing through the semantics system also ensures that our screens are\nat least reasonably **accessible by default**.\"*\n\nGet started\n\nLearn more about [Compose](/jetpack/compose)."]]