This is a companion discussion topic for the original entry at https://thoughtbot.com/upcase/videos/dependency-inversion-principle
@jferris @benorenstein thanks for another great episode. Could we start to have example codes that shown in the episode links in show note?
Any recommendations on dealing with cascade dependencies drawback? Doesnât happen that much though sometime feels like there could be a better solution.
Just interesting how you guys dealing with those
Thanks in advance!
Could you be more specific? Iâll give it a shot. I am very concerned about dependencies, external and internal when I code. I am just not sure what you mean by the cascading deps.
Sure, I meant the drawback @jferris mention at the last minute or two of this episode, i.e. âŚat some level you need a place to configure all of those dependencies.
They mentioned the facade pattern shortly. So, for example you could do this if you donât want to care about the details of your use cases every time you execute them:
class App < Struct.new(:database, :mailer)
def create_todo(request)
UseCases::CreateTodo.new(database, mailer, request).call
end
end
The dependencies arenât âcascadingâ, though. Do you have any concrete examples youâd like to clean up?
btw. Great episode. Thanks guys!
Loved the way you used decorators and collection objects and the comparison with mixins. Great episode!