Criticism of Java
The Java programming language and Java software platform have been criticized for design choices including the implementation of generics, forced object-oriented programming, the handling of unsigned numbers, the implementation of floating-point arithmetic, and a history of security vulnerabilities in the primary Java VM implementation, HotSpot. Software written in Java, especially its early versions, has been criticized for its performance compared to software written in other programming languages. Developers have also remarked that differences in various Java implementations must be taken into account when writing complex Java programs that must work with all of them. Source: e01 Encyclopedia. Licence: CC BY-SA 4.0.
The Java programming language and Java software platform have been criticized for design choices including the implementation of generics, forced object-oriented programming, the handling of unsigned numbers, the implementation of floating-point arithmetic, and a history of security vulnerabilities in the primary Java VM implementation, HotSpot. Software written in Java, especially its early versions, has been criticized for its performance compared to software written in other programming languages. Developers have also remarked that differences in various Java implementations must be taken into account when writing complex Java programs that must work with all of them. ===Checked exceptions=== Java introduced checked exceptions where a method must declare the checked exceptions it throws in the method signature. This can result in unnecessarily verbose boilerplate code. No major language has followed Java in implementing checked exceptions. public class MyClass { public static void myMethod(Object item) { if (item instanceof E) { // Compiler error // ... } E item2 = new E(); // Compiler error E[] iArray = new E[10]; // Compiler error } } Additionally, in 2016, the following example was found revealing Java to be unsound and in turn making JVMs which threw ClassCastExceptions or any other kind of runtime error technically non-conforming. This was corrected in Java 10. class Nullless { class Constrain { // something here } final Constrain constrain; final U u; Nullless(T t) { u = coerce(t); constrain = getConstrain(); } U upcast(Constrain constrain, B b) { return b; } U coerce(T t) { return upcast(constrain, t); } Constrain getConstrain() { return constrain; } public static void main(String[] args) { String zero = new Nullless (0).u; } } Java has been criticized for not supporting user-defined operators. Operator overloading improves readability, so its absence can make Java code less readable, especially for classes representing mathematical objects, such as complex numbers and matrices. Java has only one non-numerical use of an operator: + and += for string concatenation. However, this is implemented by the compiler, which generates code to create instances. It is impossible to create user-defined operator overloads. ===Compound value types=== Java lacks compound value types, such as structs in C, bundles of data that are manipulated directly instead of indirectly via references. Value types can sometimes be faster and smaller than classes with references. For example, Java's HashMap is implemented as an array of references to HashMap.Entry objects, which in turn contain references to key and value objects. Looking something up requires inefficient double dereferencing. If Entry were a value type, the array could store key-value pairs directly, eliminating the first indirection, increasing locality of reference and reducing memory use and heap fragmentation. Further, if Java supported generic primitive types, keys and values could be stored in the array directly, removing both levels of indirection. ===Large arrays=== Java has been criticized for not supporting arrays of 2 31 (about 2.1 billion) or more elements. This is a limitation of the language; the Java Language Specification, Section 10.4, states that: Arrays must be indexed by int values... An attempt to access an array component with a long index value results in a compile-time error. Supporting large arrays would also require changes to the JVM. This limitation manifests itself in areas such as collections being limited to 2 billion elements and the inability to memory map continuous file segments larger than 2 GB. Java also lacks (outside of its 2D arrays) multidimensional arrays (contiguously allocated single blocks of memory accessed by a single indirection), which limits performance for scientific and technical computing. ===Lack of tuples=== Java does not natively support tuples, resulting in a proliferation of third-party implementations which must be imported and handled by the programmer. The argument against a generic tuple class is the danger it poses in proliferating unmaintainable code. === Parallel installations === Before Java 7, the installers would not remove older Java installations. It was common on a Windows system to see multiple installations of Java on the same computer. Multiple installations were permitted and could be used by programs that rely on specific versions, including malicious programs. This issue was addressed in Java 7: with the user's permission, the installer removes earlier installations. ==External links== Free But Shackled – The Java Trap, an essay by Richard Stallman of the free software movement (dated 12 April 2004) Computer Science Education: Where Are the Software Engineers of Tomorrow? (dated 8 January 2008) What are Bad features of Java? de:Java (Technik)#Kritik
Cite this
"Criticism of Java". 1789212472. e01 Encyclopedia. CC BY-SA 4.0. https://en.wikipedia.org/w/index.php?oldid=1374502518 JSON record · API collection · BibTeX · RIS · CSL-JSON · citation policy