concept SINGLE RESPONSIBILITY PRINCIPLE in category .net

appears as: SINGLE RESPONSIBILITY PRINCIPLE, The SINGLE RESPONSIBILITY PRINCIPLE, SINGLE RESPONSIBILITY PRINCIPLE
Dependency Injection in .NET

This is an excerpt from Manning's book Dependency Injection in .NET.

As the responsibility of each class becomes clearly defined and constrained, maintenance of the overall application becomes easier. This is a known benefit of the SINGLE RESPONSIBILITY PRINCIPLE, which states that each class should have only a single responsibility.

I can’t say I blame anyone for disliking such a constructor, but don’t blame CONSTRUCTOR INJECTION. We can agree that a constructor with six parameters is a code smell, but it indicates a violation of the SINGLE RESPONSIBILITY PRINCIPLE rather than a problem related to DI.

Figure 6.11. In the top diagram, the consumer has five DEPENDENCIES, which is a strong indication that it violates the SINGLE RESPONSIBILITY PRINCIPLE. Still, if the role of the consumer is to orchestrate those five DEPENDENCIES, we can’t throw any away. Instead, we can introduce Facade Services that orchestrate parts of the relationship. In the bottom diagram, the consumer has only two DEPENDENCIES, and the Facades have two and three DEPENDENCIES.