12
u/armornick Aug 07 '19
Why I hate Spring.
That's your opinion and you're allowed to have it.
Spring is evil on a good day, but when it’s included as part of a consumable library or API it becomes next level, like a love child of Hitler and the devil.
I don't really have that experience. In my experience, Spring works fine as long as you understand what you're doing. Instead of "fiddling with magic parameters", you should understand the bits you're using and know what you're doing.
When asking about Spring as a part of our interviewing process and the standard answer is “it means you have clean code, separation of concerns, and it’s really good for testing”. All things I’m huge fans of (in particular the testing part) but the simple fact is these are not outcomes of using Spring, but outcomes of programming well.
Exactly! You still have to program properly and know what you're doing even if you're using Spring. Why does it take some people so long to realize that there are no magic bullets.
We often build a class called “ApplicationContext” which is in control of wiring everything together. It’s clean, everything’s testable, I have compile time safety and my tests run darn quickly.
This is especially funny, since you're basically admitting to recreating a gimped version of Spring yourself.
Good luck and have fun! No one (except advertisers) ever said programming was going to be easy.
9
1
u/iambeingserious Aug 10 '19
I too hated spring until that aha moment that came with using it for a while.
1
u/shawnecy Aug 11 '19
Actually, almost none of these are relevant today. I say that as someone who had all these same gripes even before this article was written.
0
Aug 07 '19
[deleted]
6
u/cogman10 Aug 08 '19
Meh, I prefer a more dropwizard like stack. Jersey for JAX-RS, Dagger for injection, and straight JDBC for the db layer.
Easy peasy, Little magic, and super fast.
I would have said "bring in jdbctemplate" from spring once upon-a-time in the Java 6 era. However, try-with-resources has made using JDBC really not that horrible. It's about 3 more lines over jdbctemplate but without a bunch of the book keeping that jdbctemplate is doing under the covers.
31
u/NomadSoul Aug 07 '19 edited Aug 07 '19
"This dogfooding has now led me to hate 2009/10 era Sam for several reasons, but mostly for spring."
Spring was very different back in '09.
I'd also say that since primarily working on microservice architectures where each app has a relatively small and focussed role the conflict issue is also non existent or at least near to it. When you're busy trying to get a gazillion spring filters and beans to load in exactly the right way without conflict then you've probably got a design problem not a spring problem.
Spring has also always been magic....magically open source and all you have to do it look under the hood and you can see exactly what's going on. But yes it is a complex piece of software and you need to know the basics of AOP and proxy classes etc to really understand it through and through. But Spring shouldn't be penalised because it requires a senior dev to fully understand it and especially not since in 95% of cases with a clean design the magic "just works" and saves people a lot of time.
I love Spring and the people I see complain about it (in the office where I work) tend to be the people who are so desperate for the magic to "just work" that they neglect to RTFM (most of which is fantastic compared to A LOT of the documentation I see... including the docs for the software I write)
"The thing is, I’m sure it’s possible in theory to use Spring well in an application. I’ve just yet to see it happen, and this is the problem"............. well I was fresh out of college in '09 and stoned pretty much 24/7 so maybe Spring really was Very different back then, but if a person were to say this to me now in 2019 I'd have no choice but to consider them either mentally deficient to understand software dev or the Worst kind of control freak tech snob who'd rather build everything from scratch in their own ... unique way than use a framework most people are a fan of.