4 ms·
> The closer your code resembles pure functions, the easier it is to do dependency injection and unit testing. If the only thing you inject is data, can we sti
by loup-vaillant 6y ago
> The closer your code resembles pure functions, the easier it is to do dependency injection and unit testing.
If the only thing you inject is data, can we still call that "dependency injection"?
- nordsieck 6y ago> If the only thing you inject is data, can we still call that "dependency injection"? I suppose that's a philosophical question. Probably the 2 most common functions I 'dependency inject' are rand() and time.now(). I feel like they count, but you might not.
- g_delgado14 6y agoDefine data.
- loup-vaillant 6y agoAnything that doesn't have an arrow in its type.
- commandlinefan 6y agoYou're one sentence away from discovering Common Lisp ; )
- deleted 6y ago[deleted]
- Tainnor 6y agoI mean, if you pass a HOF to some other function, then that is also a dependency.
- loup-vaillant 6y agoCorrect, but I haven't seen it happen often in practice. I mean, pretty much every project uses HOF, but few have many of them. I also tend to avoid HOF when I can instead pass data around explicitly.