this post was submitted on 08 Jul 2023
576 points (97.2% liked)
Programmer Humor
19699 readers
132 users here now
Welcome to Programmer Humor!
This is a place where you can post jokes, memes, humor, etc. related to programming!
For sharing awful code theres also Programming Horror.
Rules
- Keep content in english
- No advertisements
- Posts must be related to programming or programmer topics
founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
I think the main reason OOP has a well-known term and pattern for dependency injection is to differentiate these two (out of multiple) options:
However, this becomes less of a pattern in functional programming as you wouldn't make such objects to begin with. In FP, you pass all parameters where a function is invoked, and DI just becomes using generic parameters. You wouldn't instantiate a dependency on each function call after all.
As this is such a minor change, it's not really talked about much and it's not really a pattern,