Square 採用 Compose 提升工作效率
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
Square 協助數百萬名賣家經營事業,從安全信用卡交易處理、銷售點解決方案,到建立免費網路商店,都能一手包辦。Square 一直以來都採用宣告式 UI,但他們決定改用 Jetpack Compose,而非繼續建構自己的架構,這樣不僅能避免維護成本,還能充分利用 Jetpack Compose 相較於 Android Views 系統的優勢。
具體措施
Square 團隊開始在 Compose 中建構設計系統,目標是讓設計系統團隊和產品工程師加快行動速度。由於他們的應用程式已採用單向資料流架構,「產品工程師可以一次替換一個畫面,非常簡單。」採用 Compose 後,他們發現「有時簡單到讓人覺得應該更複雜。就是這麼簡單。」
結果
「有了 Compose,我們就可以將重點放在 Square 本身的特色和我們的 UI 基礎架構,不必分心解決建構宣告式 UI 架構的許多問題。」
工程團隊發現,Compose 可提升生產力,讓程式碼更容易分析、整理及編寫,而 Android Studio 工具則為他們節省了許多時間。
「設定元件樣式更簡單快速。而且讀取複雜元件的程式碼也很容易。在 Compose 中,程式碼更容易整理,也更易於閱讀。Compose 的版面配置系統在概念上更為簡明,比較容易理解。建構元件時,預覽功能可節省大量時間。」
開始使用
進一步瞭解「撰寫」。
這個頁面中的內容和程式碼範例均受《內容授權》中的授權所規範。Java 與 OpenJDK 是 Oracle 和/或其關係企業的商標或註冊商標。
上次更新時間:2021-07-28 (世界標準時間)。
[null,null,["上次更新時間:2021-07-28 (世界標準時間)。"],[],[],null,["# Square sees increase productivity with Compose\n\n[Square](https://squareup.com/) helps millions of sellers run their\nbusiness -- from secure credit card processing to point of sale solutions to\nsetting up a free online store. Square has been moving to declarative UI for\na while but rather than continuing to build their own framework, they decided to move to\nJetpack Compose, avoiding the maintenance costs and taking advantage of the\nimprovements it brings over the Android Views system.\n\nWhat they did\n-------------\n\nThe Square team started building their design system in Compose, with the goal\nof enabling their design system team and product engineers to move faster.\nBecause their app is already organised with a unidirectional data flow\narchitecture, *\"It's really easy for product engineers to swap in Compose one\nscreen at a time.\"* While adopting Compose, they've seen that *\"sometimes it's\nalmost so simple you expect it to be more complicated. **Things just work.**\"*\n\nResults\n-------\n\n*\"By using Compose, we can **focus on things that are unique to Square** and our UI\ninfrastructure, rather than solving the broader issue of building a\ndeclarative UI framework.\"*\n\nThe engineering team found that Compose improved their productivity, making the\ncode easier to reason about, organise, and write, and the Android Studio\ntooling saved them a lot of time.\n\n*\"It's **simpler and faster to style components** . Reading the code for complicated\ncomponents is easier as well. It's **easier to organize code and make it\nreadable** in Compose. The layout system of Compose is conceptually simpler so\nit's **easier to reason about. Previews are a big time saver** when building\ncomponents.\"*\n\nGet started\n-----------\n\nLearn more about [Compose](/jetpack/compose)."]]