6 ms·
This article also inadvertently shows what I think is a big drawback of the inversion of control pattern. Imagine you are trying to debug an issue with user cr
by biomene 5y ago
This article also inadvertently shows what I think is a big drawback of the inversion of control pattern.
Imagine you are trying to debug an issue with user creation.
In the last example, you would have to look up everywhere `createUser` is being called, and follow the code path through several different scattered files until you find your issue.
In the original code, you can simply look up `createUser` and you have the complete code flow in front of you.
- RHSeeger 5y agoThis comment speaks to me. I like to be able to follow code flow to figure out what's going on, and that means I prefer "from here to <somewhere>" rather than trying to figure out "to here from <somehwhere>". Mind you, sometimes passing in a function is the right answer, but I try to limit it to things more like higher order functions than "adding logic to an existing method".