5 concepts · 10 practice questions
A class receives its dependencies instead of creating them. That makes it testable with fakes, keeps construction in one place, and lets lifetimes be managed centrally. Constructor injection is the default; a framework only automates the wiring.
class CheckoutViewModel(
private val repo: CartRepository, // given, not created
) : ViewModel()
Sign in to read the rest and take the 10-question test.
Sign in to continue