Monzo สร้างแอปที่มีประสิทธิภาพและคุณภาพสูงขึ้นด้วย Compose
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
Monzo เป็นธนาคารและแอปที่ให้บริการทางการเงินดิจิทัล
ภารกิจของพวกเขาคือการทำให้เงินทำงาน
เพื่อทุกคน ระบบการออกแบบของ Monzo เริ่มเบี่ยงเบนไปจาก Material Design ดังนั้น
จึงต้องการวิธีที่ง่ายในการเขียนและดูแลรักษาคอมโพเนนต์ที่กำหนดเองซึ่ง
มีการพัฒนาอยู่ตลอดเวลา จึงเลือกใช้ Jetpack Compose
สิ่งที่พวกเขาทำ
เมื่อใช้ Compose คอมโพเนนต์ Material Design จะมีให้ใช้งานเป็นเลเยอร์เหนือ API พื้นฐานที่ไม่ขึ้นกับระบบการออกแบบ
Monzo ใช้ Foundation API เพื่อสร้าง
คลังคอมโพเนนต์ของตนเอง โดยใช้คอมโพเนนต์ Material เป็นข้อมูลอ้างอิง โดยเริ่มจากการย้ายข้อมูลหน้าจอทีละหน้าจอ และตอนนี้ใช้ Compose ในหน้าจอใหม่ทั้งหมด
ปัจจุบันวิศวกร Android ทุกคนใช้ Compose ในเวอร์ชันที่ใช้งานจริง "เรา
ไม่พบปัญหาใหญ่ๆ เลย จึงมั่นใจพอที่จะเริ่ม
ใช้ Compose กับฟีเจอร์ใหม่ๆ บางอย่าง และในที่สุดก็ใช้กับฟีเจอร์ใหม่ๆ ทั้งหมด"
ผลลัพธ์
ทีม Monzo ได้สร้างคอมโพเนนต์ที่ช่วยให้สร้างหน้าจอใหม่ๆ ได้ง่ายขึ้น
"คอมโพเนนต์ที่เรามีให้พร้อมใช้งานช่วยให้การสร้างหน้าจอขณะเรียนรู้ Compose เป็นประสบการณ์ที่ราบรื่นยิ่งขึ้น API ที่อิงตามช่องเป็นรูปแบบที่ยอดเยี่ยมซึ่งช่วยให้เราสร้างคอมโพเนนต์ขนาดใหญ่จากองค์ประกอบขนาดเล็กจำนวนมากได้อย่างง่ายดาย"
ทีม Monzo สามารถสร้างแอปที่มีคุณภาพสูงขึ้นด้วย Compose และเพิ่มฟีเจอร์ที่น่าสนใจซึ่งก่อนหน้านี้ไม่สามารถทำได้ใน Sprint ของตนเอง "ตัวอย่างหนึ่งคือภาพเคลื่อนไหว ซึ่งเพิ่มได้ง่ายมากใน Compose จึงไม่มีเหตุผลที่จะไม่ใส่ภาพเคลื่อนไหว เช่น การเปลี่ยนสี/ขนาด/ระดับความสูง โดยปกติแล้วแอนิเมชัน "มีไว้ก็ดี" เหล่านี้มักจะซับซ้อนเกินกว่าจะคุ้มค่ากับความพยายามและความซับซ้อนในระบบ View"
ตอนนี้โค้ดของพวกเขาสั้นลง และอ่าน ทำความเข้าใจ และ
บำรุงรักษาได้ง่ายขึ้น "โค้ดแบบประกาศวิเคราะห์ได้ง่ายกว่ามากเมื่อเทียบกับโค้ดที่
จัดการลำดับชั้น UI ที่เปลี่ยนแปลงได้ นอกจากนี้ยังติดตามโค้ดได้ง่ายขึ้น
เมื่อเขียนทั้งหมดในภาษาเดียวกันและมักจะอยู่ในไฟล์เดียวกัน แทนที่จะ
สลับไปมาระหว่าง Kotlin กับ XML อย่าเพิ่งพูดถึงธีมและสไตล์ XML
การกำหนดธีมเข้าใจง่ายขึ้นมากใน Compose ธีมของเรา
ประกอบด้วยพร็อพเพอร์ตี้ที่เรากำหนดเท่านั้น ค่าจะสอดคล้องกันในอุปกรณ์ต่างๆ
และเนื่องจากเป็นภาษา Kotlin จึงค้นหาและติดตามใน
IDE ได้ง่ายมาก"
Compose ช่วยให้ทีม Monzo ทดสอบแอปได้อย่างง่ายดายและมั่นใจว่าแอปของตนสามารถเข้าถึงได้ "ช่วยให้เราเขียนการทดสอบที่เสถียรมากขึ้น ทำงานได้อย่างน่าเชื่อถือ
และทำให้เรามั่นใจเป็นอย่างมากว่าแอปของเราใช้งานได้จริงในมือของผู้ใช้
การทดสอบผ่านระบบความหมายยังช่วยให้มั่นใจได้ว่าหน้าจอของเราจะเข้าถึงได้โดยค่าเริ่มต้นอย่างน้อยในระดับที่สมเหตุสมผล"
เริ่มต้นใช้งาน
ดูข้อมูลเพิ่มเติมเกี่ยวกับฟีเจอร์เขียน
ตัวอย่างเนื้อหาและโค้ดในหน้าเว็บนี้ขึ้นอยู่กับใบอนุญาตที่อธิบายไว้ในใบอนุญาตการใช้เนื้อหา Java และ OpenJDK เป็นเครื่องหมายการค้าหรือเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2021-07-28 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"]],["อัปเดตล่าสุด 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)."]]