Steven Kideckel

Staff Software Engineer at Patreon

Talk Title

Elevated Dependency Injection: Going Beyond the Basics with Custom Hilt Components

Room

Things

Date

01.11.2024

Time

12:55 > 40 min

Share

on Twitter

Hilt/Dagger is a popular and powerful building block in Modern Android Development. Its benefits include reduced boilerplate and compile-time magic to ensure runtime safety and performance.

By default, Hilt provides basic components, such as Singleton, Activity, or ViewModel.
It is also extensible, allowing you to create additional components for more complex use cases.

Here at Patreon, building a custom UserComponent tied to a user session has improved our codebase immensely by reducing boilerplate, increasing code safety, and making it easier to cancel work when a user logs out.

This talk will focus on the ins and outs of custom components and some simple but non-obvious techniques that we’ve used to make them nicely integrate into our app!

Highlights of the talk will include:

- Custom components and when you should use them
- The beautiful synergy of dagger components and coroutine scopes
- Overcoming the limitations of Dagger’s single inheritance and Hilt’s fixed component hierarchy
- Providing easy access to bindings in `@HiltViewModel` and `@HiltAndroidTest` classes
- A case study of Patreon’s `UserComponent`

Speaker Bio

Steven has over 10 years experience working on Android apps, from small startups to Google, and now Patreon. Originally from Canada, he now lives in the New York area with his wife and two cats.

Menu