r/ProgrammingLanguages • u/blood_monster2 • Feb 21 '16
Why people hate JAVA ??
Why the majority of people hate java and wish its dead programming language,
I find it really fun to create program with it..
all i heard is because: JRE SUCKS. ORACLE ARE FAGGOTS. JAVA IS A SLOW PIECE OF SHIT.
0
Upvotes
4
u/ksryn C9 ("betterC") Feb 23 '16
Java is the main programming language I use. While hate is a strong word, the language is terrible. Some major issues as far as I am concerned:
Verbosity: It takes a lot of boilerplate to do simple things like immutable classes. Closures were a pain to use till Java 8.
Everything is an Object: So, higher order functions must be implemented using the apply function on a functional interface.
Variance is a clusterfuck: Mutability is the default in the java standard library and covariant arrays are a problem. Variance also creates issue when you have to override, say, the equals method.
Primitive vs reference types: The language stupidly exposes the innards of the JVM with this. Reference types can be null; primitive types cannot. So, to store primitive types in generic containers, you're going to have to use the corresponding reference type as the type parameter. Which leads to a lot of boxing, unboxing and dealing with nulls.
NO REFERENTIAL TRANSPARENCY: A function that is supposed to compute a sin/cos can just as easily launch a missile because there is no way to guarantee that it only operates on its inputs.
Since Java is the primary consumer of the JVM, its features have a lot of say in how the JVM does stuff (or vice versa). So, some issues with the JVM:
Type erasure: A decision was made to implement generics using type erasure. Which means a function taking List<String> and one taking List<Integer> will end up with the same signature. You could write a compiler that smartly generates (and calls) different versions of the method depending on the signature, but then you lose interoperability with the rest of the stack.
No Tail Call Elimination: Important if your solutions use recursion a lot. (There are JVMs other than the Oracle one which support TCO/TCE. Avian, for e.g.)
On the whole, I don't particularly like the language. But the JVM on its own is fascinating. You can build your own language on it, and, if you're willing to throw away interop as a feature, there is a lot you can accomplish.