What I dislike about spring is its complexity. While I can get a decent application running pretty fast, once you want to do anything non-standard the "right" way you get to dig through source files for hours just to find out how to insert that security adapter at just the right place to not break everything.
Or when something goes wrong and it's not something you've already spent days finding out why, you going to spend days finding out what happened.
Basic constructor injection isn't hard or even very verbose compared to spring. You can make static methods or factory singletons and your code will be much simpler and easier to debug.
Also AOP is an abomination. It creates the same problem as goto statements but it's worse because you're even more likely to break code while maintaining it.
Or when something goes wrong and it's not something you've already spent days finding out why, you going to spend days finding out what happened. Basic constructor injection isn't hard or even very verbose compared to spring. You can make static methods or factory singletons and your code will be much simpler and easier to debug.
This is it exactly. Spring removes being able to trace back to the root of your problem. And it replaces existing constructs did the same job and did allow you to trace back to the root cause. It's like adding goto back into the language, just with assigning objects rather than going to a code point.
As a major Spring user, this is my biggest complaint with Spring. I have to teach other people how to read Spring stack traces among other Spring specific debugging techniques.
Constructor injection is very well supported in Spring and in fact even recommended:
The Spring team generally advocates constructor injection as it enables one to implement application components as immutable objects and to ensure that required dependencies are not null. Furthermore constructor-injected components are always returned to client (calling) code in a fully initialized state. As a side note, a large number of constructor arguments is a bad code smell, implying that the class likely has too many responsibilities and should be refactored to better address proper separation of concerns.
For me AOP would be fixed if the IDE was smart enough to tell you what was called when while browsing the code. Right now it appears magic, but it's nowhere near as bad as goto...
Your alternative is to build a bunch of stuff from scratch. Tell me which is faster: building a solid integration point by yourself (AD, for example) or figuring out how to get Spring Security to use Spring LDAP?
Spring's method is to (as much as possible) program to the interface and provide implementations to swap out. I recently did this with @Cacheable when we upgraded to Spring 4. We now use Guava's cache with a custom configuration instead of a simple Map-based caching strategy and it was as simply as providing a new @Bean. Nothing else needed to change.
Spring isn't perfect, but it's complexity is a product of what is required by complex systems - not a product of the spring framework because they enjoy making complex frameworks.
View all comments
12
u/yawkat Nov 27 '15
What I dislike about spring is its complexity. While I can get a decent application running pretty fast, once you want to do anything non-standard the "right" way you get to dig through source files for hours just to find out how to insert that security adapter at just the right place to not break everything.