4 ms·
I worked on a pretty large java codebase (Stubhub) and actually found most of the code was well organized and very consistent in its architecture. The one thing
by computerdork 3y ago
I worked on a pretty large java codebase (Stubhub) and actually found most of the code was well organized and very consistent in its architecture. The one thing I didn't like was the usage of Spring pretty much throughout. For the most part, I never had to use dependency injection to solve a problem, and realized that all the extra time and energy used to learn the Spring code and debug its problems (like adding in a new component using autowiring) was clearly not worth it.
But, there was one situation where I had to change the name of a component/constant (can't remember what it was) that was used throughout a very large microservice (like 24 different places or something). This component was autowired using Spring. If I had to rename it by hand, it would have required doing a search and replace in all those places, but instead I had to change the name in one file. It saved me like an hour of time.
Guess what I'm saying was it saved me like in hour in this one particular situation, but cost me days worth of time in learning it's overly complex code and debugging it. Yeah, I feel as though it is a solution in search of a problem and completely not worth it (and overall, I like Java. Yeah, to save Java, Spring must find a it's way to the ash heap:).
- computerdork 3y ago... actually, to add to this, there is one other HUGE situation where it is beneficial, Spring Boot. Spring Boot is pretty awesome and think it uses the dynamic component wiring of Spring to put together its components. Was thinking awhile ago they need to re-create spring boot but without spring (if this is possible)
- imtringued 3y ago>I never had to use dependency injection to solve a problem, Here is some life advice. Start passing your dependencies through the constructor instead of using a "new X()" call in the constructor. That is what dependency injection is all about.
- vvpan 3y agoYeah, that has been my experience. Dependency injection makes code more difficult to deal with, read and debug without any obvious upsides. I am sure it can improve testing but, for example, in JS world Jest seems to do that just fine and aligning your whole codebase with DI does not make sense.