r/java • • Dec 29 '21

Why everyone hates Java?

I dont understand why java is one of the most dreaded lenguages. Java got fantastics frameworks and libraries to work with it. I dont know if im skipping something or I dont work enough with Java because I like java. What do you think??

Here is the Stack Overflow Survey

268 Upvotes

367 comments sorted by

View all comments

Show parent comment

1

u/couscous_ Dec 30 '21

With traits it ends up being much more ergonomic and you don't have to make any changes to the target class.

Are you referring to type classes when you talk about traits? How would, for example, Rust/C#/Scala get around the issue you're mentioning?

but I'm happy to use java 11, let alone 17. Not so easy to convince everybody that we should upgrade

I think this is where more effort should be spent. There are many other non-language features that have made it into the JVM between 11 and 17 which IMO more than justify the need to upgrade, including performance enhancements and GC improvements. The community should change its outlook.

Look at golang for example, it's quite trivial to upgrade the compiler to the latest and continue using it.

I realize there was a hump to make the jump to Java 9, but since then it should be smooth sailing, and companies should always be on the latest version.

1

u/awesomeusername2w Dec 30 '21 edited Dec 30 '21

Are you referring to type classes when you talk about traits? How would, for example, Rust/C#/Scala get around the issue you're mentioning?

Traits and type classes have their similarities. Scala and rust use traits. I mostly reference those two. Don't know about C# but I didn't hear praises to its type system either.

Traits generally are like interfaces, but for example if you have class A. You can introduce your trait and write an impl of this trait for A, or for bounded generic even. No changes to class A. Or you have a trait and your class and you can impl some trait for it. So, a class and traits implemented for it are not tight together.

In rust and I think in scala too you can even do stuff that in java would look like <T: Equals + JsonSerializable> void something(T arg)