I’m developing a small gem, while at the same time I’m learning and trying to apply concepts used in dry-rb
In this gem I’m using dry-configurable to provide the user with a way to configure some settings, some of them being expected to be constants implementing certain interfaces which the end user has to write.
Used in this way, as I see it, dry-configurable acts as a kind of IoC: it allows higher level classes to depend on abstractions instead of on concrete classes.
This was about the interfaces the user is forced to write. Now, some high level classes in my gem code also have some collaborators and I was thinking in a way to be able to inject them. First I thought about using a container with dry-container, but then I realized that the main reason I want to be able to inject my collaborators is to provide the user with a way to overwrite some behavior at the same time that I keep my code simple. So, being user configurable things, I think that the best place where that collaborators can be is as dry-configurable settings. This enforces the view of dry-configuration as an IoC container.
My question is just about how you see it. I’m quite newbie with this concepts and I wouldn’t like to fell in some anti-pattern or to do things more complicated that they are.