At the moment, the application I work on relies on an ISettingsService
which is injected via the constructor; classic dependency injection. As time goes and the application's capabilities (understand complexities) build-up, the quantity and diversity of the settings exposed by the service have grown.
Some classes require ISettingsService
to access just one out of dozens of settings, and it feels wrong. In order to resolve this, I am considering to create sub entities which would map subsets of settings, for example IDisplaySettingsService
, which would map to the relevant properties of ISettingsService
.
What are the reasons I should or should not do this? On one hand it seems that the dependency is more targeted, but it also feels that the mapper is just hiding a greater dependency: IDisplaySettingsService
requires ISettingsService
to be injected. So, am I truly solving a problem here?
My situation is similar to this post, but the angle of the question and the answers are slightly different.