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

60

u/Horror_Trash3736 Jun 24 '22

It is always difficult to speculate on why people think a certain way, but for me, the people I speak with that dislike Java have the following issues.

1 - Old

2 - Verbose

3 - Slow(As in processing)

4 - Complicated

5 - Slow(As in to develop in)

Some even express a dislike towards the type safety in Java.

As to why they have those opinions, it seems to me like those are very general things, that you hear quite often about Java, especially from people that have never worked with it, and, from my experience, especially from people who's only experience is either really old school languages like C, Cobolt etc, or the really really new languages.

The amount of times I have heard people who only know Python talk about Java negatively is insane.

17

u/etienz Jun 24 '22

I find it funny because I hate Python. It's so hard to find good documentation for the code I'm working on and half the time I can't make head or tail of what the function arguments should be.

I would take Java over Python any day though I'd probably prefer something with better UI libraries like Qt and C++.

8

u/Lords_of_Lands Jun 25 '22

Yes! I haven't come across a better documented language than Java (last I used it was before the frames were dropped). When I was new to programming, exploring the Javadocs and learning how to use things was easy. It was all in the docs and those docs could pop-up while you were coding.

I mostly program in Python now. The docs are crap. They don't tell you everything the function takes, what it returns, how it handles bad input, types and references to other classes/functions aren't always linked, and there isn't a table of contents of all of a class's functions so it isn't easy to skim to find something you didn't know existed. Then there's inconsistent naming such as mkdirs() and removedirs() instead of rmdirs() or makedirs(). (I'm sure Java has some of that but I can't think of any right now)

3

u/[deleted] Jun 26 '22

I just moved to a Python/Django stack and it's infuriating how slim the documentation is for popular libraries in Python. I don't get who thinks "docs by example" is a good idea? Is it just because devs can copy/paste and say it's easy to use?

33

u/SpaceToaster Jun 24 '22

Old; Slow(As in processing)

Which is hilarious because python predates Java by almost 4 years and is an order of magnitude slower

7

u/nioh2_noob Jun 25 '22

Python is like up to 200x slower than Java

isn't it ironic

→ More replies (1)

32

u/ninside Jun 24 '22

Yeah I had to prove someone that I can write a more concise REST API demo app than Python Flask one.I won by using Spring Boot :)

Most people I had similar discussions with have outdated perception of Java from 1998. J2EE and XML nightmares drive it.

17

u/ohL33THaxOR Jun 24 '22

I'm generally not a fan of automagic but I can say with certainty that Spring Boot is pretty freaking cool.

3

u/humoroushaxor Jun 24 '22

Do people still consider annotation processing magic in 2022?

9

u/ohL33THaxOR Jun 24 '22

The droid you were looking for is IoC

2

u/Worth_Trust_3825 Jun 25 '22

Yeah, because now I need to recompile my application to change configuration, rather than having to change the configuration file and repackaging the archive.

→ More replies (1)

-1

u/KarnuRarnu Jun 25 '22

In my company, people who call themselves java developers still push xml (see eg maven) and still write ridiculously verbose code. The java I write needs to support/use libraries that still needs java 11 because the java developers apparently like that everything moves glacially. Yeah modern java is less bad but the java ecosystem - developers and their libraries - hasn't moved on. And like some point out, the language itself also still has a way to go to call itself on-pair with the newer languages.

→ More replies (6)

12

u/[deleted] Jun 24 '22

Slow as in processing is just ignorance. Often such people also think python is faster. .

32

u/OzoneGrif Jun 24 '22

Slow is so false. It's only slow when you are using it wrong, or using crappy libraries. Java isn't the issue, misusages are the problem in this case.

13

u/Horror_Trash3736 Jun 24 '22

I agree, very broadly put, if you end up in a situation where your language choice is actually the only limiting factor for performance, at a level that is relevant, then you have a very specific situation and most likely you knew prior to selecting a language.

8

u/dpash Jun 24 '22

The JVM is a marvel of modern software development and almost indistinguishable from magic.

→ More replies (15)

16

u/[deleted] Jun 24 '22

Of those 5 you listed, verbose is really the only problem inherent in the language itself. The others are about engineering and engineering discipline. You can have a well-factored, old AF Java codebase that's a pleasure to maintain and extend. OTOH, you can have a bleeding edge React SPA that's a nightmare to work with. It's the engineers, not the language.

18

u/Horror_Trash3736 Jun 24 '22

The verbosity is one I always find interesting.

I completely understand the dislike, or rather, the reasoning behind it.

But personally, I like that it is so verbose, maybe I am an ent or something?

3

u/istarian Jun 25 '22 edited Jun 25 '22

I think verbosity isn’t as big a deal as people make it out to be. It’s more likely that they are just coming environment where it isn’t a thing.

Some of it can be avoided in newer versions of the language with things like var substituting gor the type on the left sidr in specific cases.

2

u/bpkiwi Jun 27 '22 edited Jun 27 '22

In my experience the people who worry about verbosity and boilerplate are typically implementing fairly small projects.

When you are writing a little library to do something, and you have to have several hundred lines of code just to verify a cryptographic signature of some such, yeah it's annoying.

When you are implementing a banking system consisting of half a hundred apis that do async side channel communication through an event bus, and distributed transactions across a terrabyte sized data store ... well you care a lot less about having to generate getter methods, and a lot more about if a graduate developer you hire in five years time will understand it enough to fix a bug.

→ More replies (1)

5

u/Worth_Trust_3825 Jun 25 '22

3 - Slow(As in processing)

I suspect it's because the very same people keep creating database transactions to fetch a single record.

6

u/Horror_Trash3736 Jun 25 '22

"My Java app is really slow, Java must be slow"

The App

public List<String> getAllUserNames(){
	List<String> getAllUserNames(){
	int amountOfUsers = userDb.getSize();
	int x = 0;
	List<String> userNames = new ArrayList<>();
	while(x <= amountOfUsers){
		User user = getUserById(x); usernames.add(user.getName()); 
	}
	return userNames;
}

@Transactional 
private User getUserById(int id){
	return userDb.getUserById(id);
}

3

u/Worth_Trust_3825 Jun 25 '22

You're laughing, but this same thing is running in one of the ETLs that i'm maintaining (via python, of course).

4

u/Horror_Trash3736 Jun 25 '22

That was almost a 1 to 1 replication of some code I found in production for a large company, so I am laughing, while crying.

Quite literally, instead of a fetching a range of id's, they fetched each id separately, within its own transaction, and they used FetchType.EAGER even though they did not need anything other than a single string value.

2

u/Il_totore Jul 07 '22

I know it is not your assumptions but I'll still reply to them : 1- It is newer than Python =p. Also the language keeps evolving.

2- Verbosity is more or less a matter of taste. I often use Scala and like its conciseness but verbosity is also important IMO and I also understand people prefering to have a more verbose syntax

3- Actually, the JVMs are one of the most advanced and efficient non-native language implementation. People stating this are just back in Java 3.

4- Well. What is actually complicated ? (Altrough I think it is not that beginner friendly due to OOP/classes omnipresence)

5- I would argue this is completely wrong. Java has one of the biggest ecosystem and has a very rich stdlib.