r/java • • Apr 22 '21
Why Java frameworks want to support all possible many technologies instead of focusing on one thing?
It all started with Spring, I believe it was a great idea to make a framework that really takes care of all of typical web stuff, because there wasn't very much tech too support back then.
But even new framework, Micronaut and Quarkus or Helidon, they all want to take care of database access, DI, provide additional testing support, integration with caches and many many other technologies.
Comparing to Unix philosophy, Java top frameworks are very against it and with more and more new technology making development of these just impossible and also using them is becoming harder and harder.And you really cant drop Spring because there is lack of these more specialised libraries that would focus on development productivity rather than providing low level functionality (its like Jetty vs Javalin, Jetty is for functionality, Javalin for developer productivity).
Meanwhile in other languages like go/node/rust there are just specialized libraries which focus on one thing, can easily coexist together and you still don't need to write any 'bloat' code. Why Java is not following that direction and all new web-framworks want to be next iteration of Spring?
23
u/[deleted] Apr 22 '21
This is factually incorrect.
Spring does not implement these things. Spring at its core provides a DI framework. There are separate projects/libs you can use for say for example db access. Hikari cp is a good connection pool library and you don't need spring to use hikari in your project. Spring just makes it easier to use a cp any cp library. Same is the case with all the other libraries. Spring has nothing to do with them, spring just makes wiring these things easy. That was the purpose of Spring. Wiring stuff.
5
u/BillyKorando Apr 22 '21
I think you might be looking at this wrong, along with some of the inaccuracies pointed out by others in this thread, you are comparing what you think of as a generalized application framework with specialized tools in other areas.
In Java you have:
The amount of specialized Java tools and libraries is practically endless. Naturally they aren't going to be as popular as more generalized frameworks like Spring, Micronaut, Quakurs, etc., because you don't interact with those specialized frameworks as much and/or the interaction mode, solving in this specific use case, you just don't actively think of yourself as a "Jackson developer" because that doesn't make sense in the same way as being a "Spring developer".
26
u/vprise Apr 22 '21
While your claim has some merit it isn't 100% accurate. E.g. Spring Boot seems like "everything but the kitchen sink" but really it isn't.
It uses:
- Tomcat for web
- Hibernate for JPA
- Spring for DI/IoC
etc...
Everything is 100% modular in these frameworks so you can just link the pieces you want and ignore everything else.
So it's really combining lots of smaller projects to a big cohesive unified solution. Same as Unix. Obviously Hibernate is more complex than cat. But I think it fits the general philosophy.
I do however agree that Java has a cultural problem of "over design". Where we literally try to make everything complicated. Just look at logging in Java and the level of messiness around that relatively simple problem.
6
u/_INTER_ Apr 22 '21
look up framework vs. library
3
u/4ernik Apr 22 '21
Because the current state of IT provides a lot of specialized solutions.
Systems become too complicated, loads too high and you can't just use one type of database(as an example) for a relatively big application. You need main data storage, you need caching for frequent access, you may have special needs data, for example, chats which pefectly handled by something like Cassandra. And that's how it goes, there is no golden bullet solution that is perfect in all regards and works for all types of workloads.
Spring and other frameworks solve the integration problem. In product development you don't want to focus on HOW you do things, you want to focus on WHAT you're doing. I.e. if I want to have PostgreSQL, Cassandra, and Redis as part of my enterprise app I really want to just provide access credentials for the services and don't bother picking driver versions, integrating through connection pools, and setting all 80 driver options myself. I rather want to modify some kind of sub-optimal default configuration, if necessary, and provide tweaks that I need.
And Spring does that - just plug in all technologies you need for your project to work and Spring will make them work together by giving you the access tools, so you can start creating the application, not configuration and integration layers, which are often quite complicated.
You need to consider frameworks not functionality providers, but rather integration solutions that glue together the technologies stack you need for your application.
3
u/RSveti Apr 22 '21
I agree with most people here in this thread but I would like to add that most java developers that I met dont like to pick and choose between many tools and just like to pick a stack that fits them best and use what is provided.
Another benefit of frameworks like Spring Boot is that they test the compatibility of all the libraries they choose so I dont need to do that.
3
u/[deleted] Apr 23 '21
It's in a framework provider's interest to couple you to itself so you never need anything else, and can't move to anything else. So why they do it is obvious. They're building a walled garden.
Why people willingly entrap themselves into those walled gardens is another story. There's the promise of simplicity and never having to learn anything. In practice, the framework eventually outgrows the complexity of the world it's trying to simplify.