December 2018
Intermediate to advanced
414 pages
10h 19m
English
The first one is pretty easy to spot: we are not using the Injection at all. Instead of being Injected, the dependency is instantiated inside the object that depends on it:
class FeaturedProductsController { private let restProductsService: ProductsService init() { self.restProductsService = RestProductsService(configuration: Configuration.loadFromBundleId()) }}
In this example, ProductsService could have been injected in the constructor but it is instantiated there instead.
Mark Seeman, in his book "Dependency Injection in NET", Chapter 5.1 - DI anti-patterns, calls it Control Freak because it describes a class that will not relinquish its dependencies.
The Control Freak is the dominant DI anti-pattern and it happens every ...
Read now
Unlock full access