Twitter 運用 Compose 提升開發人員的工作效率和速度
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
Twitter 是最熱門的社群媒體平台之一,使用者隨時都能掌握全球動態。工程團隊開始使用 Jetpack Compose,讓設計系統煥然一新。
具體措施
由於 Twitter 應用程式的 UI 元件和主題系統是在 10 年前開發,且包含需要大量維護工作的舊版元件,因此工程團隊決定使用 Compose 建構新的可擴充設計系統,並採用易於使用及維護的無狀態 UI 元件,以直覺化的方式實作、擴充及自訂。
該團隊透過內部設計系統,開始逐一替換元件,並在不依附於舊版設定的新畫面中導入 Compose。
結果
Compose 確實能達成他們的目標,也就是提升開發人員速度、開發人員滿意度,以及 UI 程式碼/元件的可維護性。Twitter 工程師表示,開始使用 Compose 後,他們覺得「用一個字來形容就是:不可思議。我們在內部將其稱為 Android UI 2.0,這使得我們很難再深入研究舊版檢視區塊系統。我們專門以 Compose 開發的項目,效率和速度都提升了。」
他們發現開發和實驗速度有所提升:「我們在 Compose 中採用的任何項目,設計變更的周轉時間都比以往快得多。此外,我們在產品變更中進行了大量實驗,而以 Compose 和 Kotlin 編寫程式碼時,這項作業的進行速度更快,也更順暢。」
他們編寫的程式碼不僅更直觀,編寫速度也更快,而且更容易閱讀:「此外,我們的主題設定層變得更為直觀明瞭,而且我們可透過單一 Kotlin 檔案實現這些工作,而後者可以延伸至多個 XML 檔案,使檔案透過多層主題重疊進行屬性定義及指派。在 Compose 的環境中重新實作整個主題結構,只花了幾天到幾週的時間,而且已經證明比舊版主題系統更強大且更直覺。」
開始使用
進一步瞭解「撰寫」。
這個頁面中的內容和程式碼範例均受《內容授權》中的授權所規範。Java 與 OpenJDK 是 Oracle 和/或其關係企業的商標或註冊商標。
上次更新時間:2021-07-28 (世界標準時間)。
[[["容易理解","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 (世界標準時間)。"],[],[],null,["[Twitter](https://twitter.com) is one of the most widely used social\nmedia platforms where users can see what's happening in the world at any given\nmoment. The engineering team started using Jetpack Compose to **modernise their\ndesign system.**\n\nWhat they did\n\nBecause the Twitter app's UI components and theming system was developed around\n10 years ago and was comprised of legacy components that required tremendous\nmaintenance efforts, the engineering team wanted to build a new, scalable\ndesign system; with stateless UI components that were easy to use and maintain;\nand intuitive to implement, extend and customize, so they decided to use\nCompose.\n\nThe team started a component-by-component replacement through their internal\ndesign system and by introducing Compose into new screens that don't depend on\ntheir legacy setup.\n\nResults\n\nCompose provided a solid answer to their goal of improving developer velocity,\ndeveloper happiness, and UI code/component maintainability. After starting to\nuse Compose, Twitter engineers say that it's *\"In a word: incredible.\nInternally we refer to it as Android UI 2.0, and it makes it very difficult to\ndelve back into our legacy view system. It has **increased our efficiency and\nvelocity** for things we've developed specifically in Compose.\"*\n\nThey've seen improvements in the speed of development and experimentation: *\"The\n**turn-around on design changes** for anything we've adopted in Compose **is much\nfaster** than we would have experienced previously. Additionally, we experiment\nvery heavily within our product changes, and this is facilitated much better\nand quicker when written in Compose and Kotlin.\"*\n\nThe code they write is not only more intuitive, but also faster to write, and easier to\nread: *\"Additionally, **our theming layer is vastly more intuitive and legible**\nand we've been able to accomplish within a single Kotlin file what otherwise\nextended across multiple XML files that were responsible for attribute\ndefinitions and assignments via multiple layered theme overlays. Reimplementing\nour entire theming structure within the context of Compose took only a matter\nof days to weeks, and has already proven to be much **more robust and intuitive**\nthan our legacy theme system ever has been.\"*\n\nGet started\n\nLearn more about [Compose](/jetpack/compose)."]]