I’m “playing” with a set of systems at work that use a whole helping of spring dependency injection framework goodies.

Spring is a turd.

For all of the talk ever since we got to block structured languages with scoped variables that global variables are an evil that should be avoided.

Then we get to spring and dependency injection.

@Autowired private Foo foo;

Basically “autowired” is just a global variable holder for the most part. The spring configuration is just code (not configuration) that initializes a set of global variables.

You may as well have something in the constructor that looks like this:

foo = GlobalVariables.foo;

Sure, you don’t get the “magic” of “autowiring” but you gain the advantage that you can obviously check the state of the system in a debugger in the most obvious way. On top of that you get compile-time type checking and stuff.

Why? Why do programmers try to be tricky like this? Hiding the globals inside of syntactic sugar doesn’t make them any less global. But by hiding the implementation you also lack clarity whenever something fails.