Skip to main content
2 of 5
I called them Facade Services in my book
Mark Seemann
  • 234.3k
  • 51
  • 448
  • 778

You are right that if you use the container as a Service Locator, it's more or less a glorified static factory. For lots of reasons I consider this an anti-pattern.

One of the wonderful benefits of Constructor Injection is that it makes violations of the Single Responsibility Principle glaringly obvious.

When that happens, it's time to refactor to Facade Services. In short, create a new, more coarse-grained interface that hides the interaction between some or all of the fine-grained dependencies you currently require.

Mark Seemann
  • 234.3k
  • 51
  • 448
  • 778