Re:Ask HN: Concepts that clicked only years after you first ...
by adlpz on Sunday January 01, 2023 @10:19AM
(#34206944)
I agree with OOP not being needed at all, but I don't agree on this being an alternative to dependency injection.
However you structure it, there will always be "glue code" that ties the nice inmutable code with the outside-interacting bits, and if you want to unit test those, dependency injection (with functions or state, not classes or instances) is still the way to go.
Re:Ask HN: Concepts that clicked only years after you first ...
by mrloba on Sunday January 01, 2023 @02:31PM
(#34209866)
True, but there might not be a big need for unit testing the glue code. By its very name it doesn't contain much logic to test. Integration tests are more valuable in this case.
However you structure it, there will always be "glue code" that ties the nice inmutable code with the outside-interacting bits, and if you want to unit test those, dependency injection (with functions or state, not classes or instances) is still the way to go.