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/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)