Slide 12
Slide 12 text
// Service Locator
new Consumer1(container)
new Consumer2(container)
// Dependency Injection
new Consumer1(
container->get(FileLogger),
container->get(Communicator),
)
new Consumer2(
container->get(FileLogger),
container->get(Communicator),
container->get(AuthHandler),
)
Service Locator
hides dependencies
complicates creation logic
couples consumers to container
couples the whole app