Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Putting a Jetpack on your legacy codebase

Kurt Nelson
September 14, 2023

Putting a Jetpack on your legacy codebase

At Pinterest, we are always working on using the latest technologies when possible in our 10+ year old codebase. Adding architecture components such as Hilt and Navigation without requiring everyone to rewrite their existing features can be quite a challenge. Hear about some of the techniques and challenges the platform team at Pinterest has had to use in order to adopt these new technologies under the hood.

Kurt Nelson

September 14, 2023
Tweet

More Decks by Kurt Nelson

Other Decks in Technology

Transcript

  1. At a large organization, we need to teach about it,

    roll out access, review new usage, and handle deprecation.
  2. Google has Product Areas Android and the Google suite of

    apps historically only shared the CEO.
  3. Back at Pinterest • The app is from around 2012

    • Over 700 unique committers • Most code is O(years) old
  4. Screen API Our innocent looking Fragment replacement. fun bind(screenDescription: ScreenDescription)

    val isScreenBound: Boolean val wasScreenEverBound: Boolean fun activate() val isScreenActivated: Boolean fun deactivate() fun unbind() fun destroy() fun getView(): View?
  5. Appropriate at the time • Our app is full pages

    • MVPish • Solved fragment transaction crashes
  6. The Gotcha interface ScreenDescription : Parcelable { val screenClass: Class<out

    Screen> val screenTransitionId: Int val arguments: Bundle var instanceState: Bundle? var showBottomNav: Boolean var uniqueId: String val results: MutableMap<String, Bundle> val internalName: String }
  7. Re f lection! And basically our own version of a

    FragmentManager And our own version of Navigation And constructor injection
  8. Prioritization Which First? • Jetpack Navigation • Jetpack DataStore •

    Real Fragments & Lifecycle • Hilt • Compose • ViewPager2
  9. Prioritization Tradeoffs • Reliability • Rollout speed • Unknowns in

    our legacy code • Learning • Normal day to day work
  10. Putting a Jetpack on your legacy codebase Kurt Nelson (he/him)

    Android Platform at Pinterest Mastodon: [email protected], kurtisnelson on the socials github.com/kurtisnelson/presentations