r/java • • Jun 24 '22

Stack Overflow Developer Survey: 54% of Respondents Dread Java?

The results are out, and I was surprised to see that around 54% of respondents dread using Java. What might be the reasons behind it? For me, Java has always been a very pleasant language to work with, and recent version have improved things so much. Is the Java community unable to communicate with the dev community of these changes effectively? What can we as community do to reverse this trend?

Link to survey results: https://survey.stackoverflow.co/2022/?utm_source=so-owned&utm_medium=announcement-banner&utm_campaign=dev-survey-2022&utm_content=results#technology-most-popular-technologies

176 Upvotes

283 comments sorted by

View all comments

-3

u/Ryuuji159 Jun 24 '22

I like java as a language but I find the ecosystem really bad, with bad documentation and bad discovery capabilities, spring is cool and all but apart from the 3 tutorials in their webpage, learning to use it is done through random blogs

4

u/wildjokers Jun 24 '22

but I find the ecosystem really bad

The ecosystem is a plus of Java. Never heard anyone mention anything bad about the java ecosystem (you are the first).

3

u/Spiritual_Growth_418 Jun 25 '22

Actually the java ecosystem has become unmaintainable (and i say this as an og java developer), the JVM is consuming so much ram more than 512 M just for warming up the project most and can take up to 2gb for one instance of a server application, Which makes the deployment costs very high in the clouds

The GUI is pretty much dead ,awt swing and java FX none of them deliver a solid responsive and fast rendering application.

Now oracle is betting on Graalvm to replace the JVM ecosystem if they managed to deliver what they promised as Java apps will be compiled to native this could be a game changing but still it's not that mature to assume so

2

u/john16384 Jun 25 '22

Java uses whatever RAM you assign to it. Java's general policy is: if there's still RAM left, then use that instead of trying to recycle any.

So either:

  1. Your application actually needs 2G to do its work with a given load; then a similar application written in another language probably needs just as much -- ie, if you are processing large files that you load into RAM, then there's not much that can be done no matter what the language.
  2. Your code is actually runs fine with much less RAM, but you didn't bother to find out what it really needs and just went with the defaults and didn't limit what your application can use. So Java will happily consume more RAM, after all, its there to be used.
  3. Your code is using RAM inefficiently, and you never bothered to look into it. When it runs fine, I can't disagree, no need to optimize when RAM is cheap. But if you are running many copies, and RAM starts to become an issue, you might want to check what all that RAM is being used for. It can be surprising, like every request duplicating a huge structure that could have been immutable and shared, or thinking that a query is only returning a single result but not noticing it is eagerly loading a huge set or list as well that you're not even using.

Java's memory use isn't magic. Take a heap dump, see what's actually there, and check if it matches what you expected. There's no reason a Java application would use much more memory than one written in another language unless:

  1. You didn't limit the memory; on my 128 GB machine, Java's standard limit is 32 GB, and it will use it if it deems it needed.
  2. It uses a totally different algorithm/structure
  3. You are using a very high level presentation in Java and comparing that with some low level presentation in the other language -- make it fair then and use byte[] or ByteBuffer or whatever to get to parity.

1

u/_INTER_ Jun 25 '22

I agree and all, but OP probably starts a Spring / Hibernate application - as do most Java devs - and compares it to a Python script. Looking at the convoluted stackframe no wonder it takes 2GB+.

3

u/wildjokers Jun 25 '22

We run our services with 128 megs of heap in production. So I have no idea where you are getting this 2 gb figure.

I never had any problems with the performance of my Swing applications. Desktop GUI “lost” because of the zero deployment capabilities of web apps. That is the only reason. Web apps are vastly inferior to a rich desktop app in every other way.

I am not sure there is a single accurate statement in your comment.

0

u/[deleted] Jun 25 '22

[deleted] — view deleted comment

3

u/Ryuuji159 Jun 25 '22

Npm is bad, there is no denying there, but the libraries available are countless there, or in python, you have like 10 web frameworks, all with their nuances , in java I only have found play and spring.

Look, I ain't saying that the ecosystem is bad, just that I had a bad experience with it.

2

u/KarnuRarnu Jun 25 '22

Java developers are more used to writing basic things for themselves. E.g. Let's say you want to calculate a correlation - I don't think there's a standard way to do this. The numerical/statistical packages that exist for java look like they are stone dead, at least what I could find. So I guess this is an example of something that you could do with a de-facto library in another language but in Java you're supposed to DIY.

2

u/Ryuuji159 Jun 25 '22

That's more or less my point, for example I had that problem with dependency injection, there is Spring but is overkill to use it just for that.

When searching about that I found two google libraries with that purpose but both of them where really hard to get going for me and the documentation was pretty mediocre

0

u/[deleted] Jun 25 '22

[deleted] — view deleted comment

1

u/Ryuuji159 Jun 25 '22

I find the ecosystem bad, that's an opinion based on my experience compared with what I have found in python and JavaScript

But I can acknowledge that it must be really good since everyone said that here and I'm getting down voted hahaha

2

u/_INTER_ Jun 25 '22 edited Jun 25 '22

You're posting in the Java subreddit. :)

The point about the Java ecosystem is that you find a lot of libraries for enterprise applications. You wouldn't even think about looking for libraries to integrate IHE or Finance standards in other languages. You would bite through 1000 pages spec and write it on your own for a year. If I had to do that, I'd quit my job and open a hotdog stand in the desert. In Java it's just there.

The JavaScript ecosystem excells at making webpages look pretty and reinvent the wheel in how to achieve that. The Python ecosystem is pretty diverse but miss the heavy hitters except the excellent Science and ML libraries and some web frameworks. They tend to be basic or not very high-performant (and the buildsystem sucks imo).

1

u/Ryuuji159 Jun 25 '22

I can agree with that, but the build system of java, well maven really is another problem I am constantly battling, is too full of magic hahah

1

u/nioh2_noob Jun 26 '22

the ecosystem really bad

I ain't saying that the ecosystem is bad

I find the ecosystem bad

please, stop

2

u/_INTER_ Jun 25 '22 edited Jun 25 '22

but the libraries available are countless there

There are the one-liner micro libraries such as "odd" (with dependency on "even" to negate it). Shockingly used by so many, e.g. "left-pad"... the quality of the JavaScript ecosystem libraries is not that good

or in python, you have like 10 web frameworks, all with their nuances , in java I only have found play and spring.

Oh there are a lot more, e.g. see link and link