Hacker News new | ask | show | jobs
by erokar 1734 days ago
> After that you have to choose a framework, because Java applications are very framework-heavy ones. And that's where most of complexity comes from. People usually use Spring these days, so that's probably would be the most reasonable choice. There's no easy path, you'll struggle a lot and that's unavoidable. Modern Java Frameworks are full of hard to grasp concepts, tricky magic code and 20-year old roots buried in the depths of stacktraces.

Honestly that does not sound like a culture/ecosystem it is pleasurable to work within. Why wouldn't people choose something more modern and lightweight than Spring?

3 comments

One of the strongest points of using a framework is that it's easy to find other people who already know that framework. And that depends on framework popularity. It's like old motto "nobody was fired for choosing IBM".

Spring is not well suited for modern microservices running in the cloud. Its startup time is slow and its memory usage is high. There are other frameworks emerging, optimized for GraalVM native image, most notable ones are Quarkus, Micronaut, Helidon. But their popularity is nowhere near Spring. May be in 5 years things will change.

> Honestly that does not sound like a culture/ecosystem it is pleasurable to work within.

I agree. Of course I’ve heard people criticizing and making fun of java over the years, but I didn’t realize the (very helpful and thoughtful) answers to my question would be so depressing.

Spring is largely "Java: the missing parts", implemented in a very poor way. It's semi-standard, even though it's not part of the core language.
What's weird is that every app in Java uses a DI container, while just about no apps that I've encountered in the rest of the world worry about anything that heavy. Most apps just cheat and use a bit of global state or maybe roll their own service locator pattern and don't worry about it. From the outside it seems like Java's sweet spot is really massive applications where you can't just cheat in one or two well-known spots in the code and call it good.
The sad thing is that DI doesn't need to be heavy. I looked into this for some projects I was planning, and there are some lightweight (if technically off-putting, IMO - see Dagger 2 syntax) ways to achieve this. But everyone just reaches for the big frameworks in the first instance.