• philm@programming.dev
    link
    fedilink
    arrow-up
    0
    ·
    1 year ago

    I guess I’m a little bit too long already in the functional/data-driven world (after being a decade in OO languages (IMO too long…)). In OOP you may need a separate term for that.

    But I think it’ just not really necessary in functional programming, it’s just another parameter when calling a function, that may be a somewhat type-constrained generic (for testing e.g. with a mock implementation).

    I mean function parameters are somewhat dependencies anyway, so should I call all my parameters now dependencies and invocation “injection”?

    • bjornsno@lemm.ee
      link
      fedilink
      arrow-up
      1
      ·
      1 year ago

      Thought you were OP for a second there, as they were talking about composability. Whether it’s dependency injection or not depends on what shape your parameters take. If you’re doing functional programming and you’re passing handlers and connections etc. as params, that’s dependency injection. If you’re only passing strings and objects and such and the function has to do a bunch of logic to decide how to handle its params, that’s not dependency injection.