7 ms·
Interesting that dependency inversion principal -- [1] is like an extreme case of pushing ifs up by encoding the if into the type interface implemention. Ultima
by theteapot 3y ago
Interesting that dependency inversion principal -- [1] is like an extreme case of pushing ifs up by encoding the if into the type interface implemention. Ultimately what you get with DI is pushing an if up some to ... somewhere.
# Somewhere:
walruses = [new TransWalrus(), new FrobWalarus()], ...]
...
for(walrus in walruses) {
walrus.transfrobnicaterify()
}
[1] https://en.wikipedia.org/wiki/Dependency_inversion_principle https://en.wikipedia.org/wiki/Dependency_inversion_principle
- tubthumper8 3y agoThis only works when `frobnicate` and `transmogrify` have the same argument and return types