Too Long; Didn't Read
Dependency injection is a technique at the crossroads of well known software engineering best practices: abstraction and decoupling, single responsibility, dependency inversion. It provides flexible and testable implementations of higher order free functions. This article assumes that the merits of dependency injection are accepted. We will see how dependency injection and higher order functions fit very well together. The UsersRepository is injected with an ApiService protocol whose purpose is to fetch users from the Rest endpoints. The repository doesn’t care about where they come from, it is an implementation detail. The publisher should only be built if and when needed.