r/ProgrammerHumor • • Apr 06 '22

Java is hard

Post image
5.0k Upvotes

424 comments sorted by

View all comments

Show parent comments

-5

u/Equivalent_Yak_95 Apr 06 '22

First: I would note that for math applications, Java is among the WORST options.

Second: I’m not intimidated by it, I’m annoyed by it.

You have to make a class and given it a public static void main(String[]) function JUST TO PRINT “hello world”!

You know what that is in Python? One line. print(“Hello world”) - then you just RUN it.

You know what it is in C or C++? Two lines if you want, 4 lines with nice formatting. Either way, an include (<stdio.h>, or <iostream> for C++) and either int main() or int main(int argc, char** argv), then the body does the output operation. Then, you compile it and link it, which can be done in a single command, then run the executable.

In Java… we (me and my group for a project in our OOP class) couldn’t get the dang thing to output a runnable file. Oh, our IDE(s) would run it, no problem, but it refused to give us an output file that could be run NORMALLY.

And generics use type eraser, so - at least in my experience - they’re far less flexible than C++ templates (even when you limit it to types).

2

u/superquagdingo Apr 06 '22

Your example doesn’t really matter though because nobody is serving up hello world in a production app and especially nobody is using C++ for their backend lmao

-2

u/Equivalent_Yak_95 Apr 06 '22

But it demonstrates the sort of extra noise needed on in Java. Let me write free-standing functions, damn you!

2

u/superquagdingo Apr 06 '22

I mean I guess but at the end of the day I’d rather maintain a Java backend than c++ or Python, and a lot of people would agree. And between Spring Boot, Lombok, IDE code generation, etc. nobody really should be writing all that extra noise themselves anyways.

→ More replies (8)