19 เมษายน 2565
Posted by The Android Team
As one of the most widely used social media platforms, Twitter is always hunting for ways to better connect its users. At the same time, in order to efficiently build new features while maintaining existing ones, developers need supportive infrastructure. The Twitter engineering team turned to Jetpack Compose to kick-start a much needed overhaul of the app’s UI foundation. With Compose, developers can easily find and use the right APIs, fluidly style and modularize components, and ultimately build more with less code.
A handful of teams such as the Android Client UI team, Customer Acquisition, Twitter Blue, and Communities teams revamped their development processes, inspiring excitement among Twitter’s engineers. “Several teams at Twitter have adopted Compose in their daily workflows,” said Sneha Patil, senior software engineer and technical lead on the Communities team for Twitter for Android. By removing the work of creating and setting up custom theming and attributes, Compose made writing functions and implementing design requirements significantly faster and more simple than what they experienced with Views. Jetpack Compose enabled these teams to work faster and more effectively, ensure reusability in their code, and easily onboard new engineers.
Creating dynamic content is straightforward with Compose. The Twitter team used the LazyColumn composable to build UI without the need for an Adapter or ViewHolder, simplifying the process of writing code that seamlessly brings layouts, themes, and styles to life. With fewer lines to write, development teams at Twitter decreased their boilerplate, experienced less bugs during development and releases, enabled UI experimentation, and sped up the testing processes. These improvements heightened productivity so developers could spend more time building what makes Twitter unique.
They also used Compose to build stateless components that are reusable across the app. The flexibility of Compose made it easier and faster to meet design requirements, making the setup of theming and styling easier for both new and experienced engineers to work with.
Given the improvements experienced, they decided to build an entire new feature using Compose. They built the Communities feature, Twitter's dedicated space where users can engage in discussions they care about most, from the ground up using Compose. Based on the teams’ previous experience using Views for other features, building with Compose was much faster and they had less bugs. “It was like magic,” said Sneha, “It’s a game changer for how we can develop on Android with Compose.”
Compose boosted the velocity and efficiency of Twitter engineers’ UI development. Developers easily incorporated and built with Compose, which made it easier for them to modularize code, reuse components, and break down dependencies. The team regularly utilizes UI experimentation, and Compose helped increase their confidence in knowing what the components that react to user interactions, data updates, and different screen sizes will look like in production.
These teams’ initial success with Compose inspired other development teams at Twitter to follow suit. Now, even engineers working on complex legacy components are looking into adopting it.
Overall, Compose has not only removed many of the obstacles the team experienced in Views — it also added enjoyment into the workflow, with some developers ready to abandon old methods for good. “I’m excited to write more Compose and never touch an XML layout again,” said Yoali Sotomayor Baqueiro, software engineer for Android Client UI at Twitter. “It makes developing UI not just easier but also much more fun and intuitive.”
Optimize your UI development with Compose.