Tom Ritchford
Dec 6, 2022

--

I'm sorry, but I have to disagree.

Dependency injection really only seems to be a thing in the Java community. I have only seen one C++ program that used this aggressively, and it was a horrifying mess, with a large number of pointless parameters for tests that were intended but were never actually written. There is simply no need for this in Python, as you can use the Magic Mock. Generic programming largely makes this unnecessary in C++. I have no idea what JS programmers do.

Your API should reflect the actual calls you make during run time. Adding parameters to your API calls simply for testing is a weak idea, one which makes the code bulky and hard-to-read.

--

--

No responses yet