Thumbtack Dominic Zirbel May 12, 2023

Cork: Thumbtack's Android UI Framework

Article Summary

Dominic Zirbel from Thumbtack reveals how they modernized 300+ Android screens without a complete rewrite. Their new framework cut code by 30% while maintaining production stability.

Thumbtack's Android team faced a common challenge: their 2018 RxJava-based MVP architecture worked but couldn't leverage modern Android tools like Jetpack Compose and Coroutines. They built Cork, an opinionated MVVM framework that wraps modern Android components with guardrails to ensure consistent, performant implementations across their two consumer apps.

Key Takeaways

Critical Insight

Thumbtack successfully modernized their Android architecture by creating an opinionated wrapper around standard components that prevents common pitfalls while enabling incremental adoption.

The article includes detailed code examples showing how Cork's event handling differs from typical MVVM patterns and why they chose objects over functions for screen-level components.

About This Article

Problem

Thumbtack built RxArch as an MVP architecture in 2018, before modern Android components were available. It had real problems with presenter lifecycles during configuration changes and needed to serialize the entire UIModel, which made persisted Bundles unnecessarily large.

Solution

Cork uses Jetpack ViewModel to handle lifecycle management and Coroutines instead of RxJava for scheduling. The UI layer uses Compose for declarative binding. The framework is opinionated by design, which limits architectural choices but enforces best practices.

Impact

When the team migrated several screens from RxArch to Cork, they saw about 30% fewer lines of code. The team was satisfied with the results and successfully deployed at least one screen built with Cork to production.