4 ms·
Yeah this is the "D"[1] is SOLID [2]. Robert "Uncle Bob" Martin talks about this in his books Clean Code and Clean Architecture. I'd recommend them. Clean Archi
by xupybd 5y ago
Yeah this is the "D"[1] is SOLID [2]. Robert "Uncle Bob" Martin talks about this in his books Clean Code and Clean Architecture. I'd recommend them. Clean Architecture is really good as an audio book.
[1] https://en.wikipedia.org/wiki/Dependency_inversion_principle https://en.wikipedia.org/wiki/Dependency_inversion_principle
[2] https://en.wikipedia.org/wiki/SOLID https://en.wikipedia.org/wiki/SOLID
- theteapot 5y agoI can't see the Dependency Inversion ("Depend on the interface not the implementation") in this?
- vikingcaffiene 5y agoThink of it like this: I am in injecting a function that returns a `User` type. That is the interface. I, the function accepting the injected function, don't care how it gets that `User` (that's the implementation). I just care that I am getting a `User`. Now, knowing that, I can inject any number of function implementations that implement that interface. As long as a `User` gets returned it does not matter how the sausage gets made so to speak.