Dependency injection is great for testability and awful for code clarity as far as I can see.
I started using dependency injection as
f(x,y, z)
where x and y were generally the same.
I changed the reference in my code to
y.x = x
y.f(z)
and it got so much clearer and dryer despite losing the dependency injection. Perhaps I'm doing this wrong but dependency injection seems like cruft from the test department. I am not an OO fanatic but OO is extremely useful for juggling a bunch of information in the best bad way possible. And juggling information in that best bad way possible is a way different problem from functional programming paradigm of finding perfect, elegant solutions to well defined problems.
I am not an OO fanatic but OO is extremely useful for juggling a bunch of information in the best bad way possible. And juggling information in that best bad way possible is a way different problem from functional programming paradigm of finding perfect, elegant solutions to well defined problems.
What's the difference between:
data Foo = Foo { a :: String, b :: String }
doSomething :: Foo -> String
doSomething foo = a foo ++ b foo
I started using dependency injection as f(x,y, z) where x and y were generally the same.
I changed the reference in my code to y.x = x y.f(z) and it got so much clearer and dryer despite losing the dependency injection. Perhaps I'm doing this wrong but dependency injection seems like cruft from the test department. I am not an OO fanatic but OO is extremely useful for juggling a bunch of information in the best bad way possible. And juggling information in that best bad way possible is a way different problem from functional programming paradigm of finding perfect, elegant solutions to well defined problems.