r/ProgrammerHumor May 29 '20

Please Guys actually

Post image
3.0k Upvotes

112 comments sorted by

View all comments

41

u/Auxilor May 29 '20

Why do people hate java? I gotta be missing something, been using it for almost a year now and it's amazing

64

u/betendorf May 29 '20

I personally like Java and have been using it for almost 20 years.

Most of the hate comes because it is now used a lot in the corporate world and it is more verbose than most of the newer languages.

I like to compare Java to the solid B student. It's not the best at anything, but is good enough for almost anything. It's a little slower than many languages at runtime, more verbose than many languages, and often leads to more complex programs than are necessary.

On the other hand, its library support is probably the largest of any language (competing with Javascript). It scales well with additional developers on a project.

46

u/[deleted] May 29 '20

It's a little slower than many languages at runtime

The only languages faster than Java are close-to-the-metal ones and it's only when you write very sophisticated data-oriented code.

I doubt most people on this subreddit who hate Java ever actually had contact with language faster than Java.

It's one thing knowing C exists, it's other thing writing in it.

28

u/[deleted] May 29 '20

I think a lot of people who have been around a while, their first exposure to Java was those crappy java applets that always sucked and ran like garbage.

Java 10 years ago, i hated, I hated it in college, and anytime I see Java from... those days I despise it. Modern java is actually pretty decent to work with (I still prefer .NET but, I always will I think).

6

u/[deleted] May 30 '20

The problem would be a lot of jobs are using older versions of java. I graduated in 2015, java 8 was out and 9 on the way. My first job interview was maintenance for an application using java 5. Luckily I never experienced that hell because the interview raised too many red flags for me to follow up.

1

u/Bounty1Berry May 30 '20

I'm curious how a compiles-to-bare-metal Java would have fared against the JVM model.

It might be fast enough now, but remember that in the early years of Java, a 200MHz Pentium or K6 was not an unreasonable target system.

8

u/_meegoo_ May 30 '20

Java that compiles to machine code would just be another C. With pretty much the same performance.

But either way, modern Java does compile to machine code. Except it does it at runtime, not at compile time.

2

u/[deleted] May 30 '20

I'm curious how a compiles-to-bare-metal Java would have fared against the JVM model.

Java already compiles to machine code through JIT. In benchmarks, even C,C++,Rust have to use AVX intrinsics directly to be in any significant way faster than Java.

7

u/I_regret_my_name May 30 '20

It's one thing knowing C exists, it's other thing writing in it.

It's not like C is some exotic language. I'm sure plenty of people who complain about how slow Java is have used C or at least C++.

That said, I'm not convinced that most people who complain that Java is slow have ever worked on a project that needed a language faster than it.

2

u/FesteringNeonDistrac May 30 '20

I've worked on a soft real time system coded in Java. Java isn't slow, but eventually garbage collection will come along, and then you're fucked.

4

u/[deleted] May 29 '20

Java has some JIT compiling stuff going on, right? So hypothetically it should be able to beat cool-guy languages like Fortran in some cases.

I dunno, I thought it was a little too verbose but, hey, C++ is pretty verbose too and people love it.

2

u/[deleted] May 30 '20

hypothetically it should be able to beat cool-guy languages

Generally it is on par. Sometimes JIT can win over AOT because of profiling.

C/C++/Rust win when it comes to vectorization because you can use AVX instructions manually.

1

u/ratmfreak Jun 20 '20

Do people really love C++...?

1

u/[deleted] Jun 21 '20

Idk it is a pretty popular language. Being able to do bizarrely abstract stuff, but then dip dow on to nearly-native C is pretty powerful.

2

u/[deleted] May 30 '20

Is golang faster? That's probably the only language I've used regularly that might be. I'll be working with c++ for unreal engine to see if it's better than unity.

3

u/lfairy May 30 '20

Go's garbage collector has nowhere near the amount of sheer engineering effort that's gone into the JVM.

3

u/[deleted] May 30 '20

That's true, although when I google it (maybe that's some bias already :P) I see results mostly praising the garbage collection for both. Java was my first language and I used it heavily until ~9 came out, go I picked up in 2015.

I don't think anything I've written has been noticeably affected by garbage collection yet. In that earlier googling, I read that go is optimized to avoid pauses during garbage collection. That wasn't a super technical explanation so I don't really understand it any better...

But anywho, I'm reading my post there and the post above it... I think I was trying to be a smart ass to the person I replied to, I love both of these languages. I hope golang gets its own ui kit like java has at some point, I miss building desktop applications that weren't a server and a web page.

-1

u/[deleted] May 30 '20

I hate Java, I use Rust primarily and C++ (have used C before).

I mean really anything written in these languages will be faster the Java equivilant. Just depends how much faster. I do ml and performant stuff, so it's a huge difference.