Twitter 利用 Compose 提高了开发者的效率和速度
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
Twitter 是最常用的社交媒体平台之一,通过 Twitter,用户可以随时了解世界动态。工程团队开始使用 Jetpack Compose 来实现设计系统的现代化。
策略
由于 Twitter 应用的界面组件和主题系统大约 10 年前就已开发,并且由需要大量维护工作的旧版组件组成,因此工程团队希望构建一个可扩缩的新设计系统;该系统具有易于使用和维护的无状态界面组件;并且可直观地实现、扩展和自定义,因此他们决定使用 Compose。
该团队通过内部设计系统并向不依赖于其旧版设置的新界面中引入 Compose,开始逐个替换组件。
结果
Compose 很好地实现了其目标,即提高开发者速度、开发者满意度和界面代码/组件可维护性。开始使用 Compose 后,Twitter 工程师表示,它“简直令人难以置信。我们在内部将其称为 Android 界面 2.0,它使得我们很难再深入研究旧版视图系统。对于我们专门在 Compose 中开发的内容,它提高了我们的效率和速度。”
他们发现开发和实验速度有所提升:“对于我们在 Compose 中采用的任何内容,设计变更的周转时间比我们之前经历的快得多。此外,我们在产品变更中进行了大量实验,而使用 Compose 和 Kotlin 编写代码可以更好地更快地完成这些实验。”
他们编写的代码不仅更直观,而且编写速度更快,也更易于阅读:“此外,我们的主题层更加直观,也更加清晰,我们能够在单个 Kotlin 文件中完成之前需要在多个 XML 文件中完成的任务,这些 XML 文件负责通过多个分层主题叠加层定义和分配属性。在 Compose 的背景下重新实现整个主题结构只用了几天到几周的时间,并且已经证明比我们以往的主题系统更强大、更直观。”
开始使用
详细了解 Compose。
本页面上的内容和代码示例受内容许可部分所述许可的限制。Java 和 OpenJDK 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2021-07-28。
[null,null,["最后更新时间 (UTC):2021-07-28。"],[],[],null,["# Twitter sees increased developer efficiency and velocity with Compose\n\n[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-------------\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-------\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-----------\n\nLearn more about [Compose](/jetpack/compose)."]]