Jump to content

Criticism of Java

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by 24.93.103.155 (talk) at 11:45, 11 December 2010 (A criticism of java is that it's object oriented? This seems like criticizing for the sake of criticizing). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

A number of criticisms have been leveled at Java programming language for various design choices in the language and platform, such as the introduction of generics, the types available for numeric variables, and the look-and-feel of its default toolkits.

Language Syntax and Semantics

Generics

When generics were added to Java 5.0, there was already a large framework of classes (many of which were already deprecated), so generics were chosen to be implemented using erasure to allow for migration compatibility and re-use of these existing classes. This limited the features that could be provided by this addition as compared to other languages.[1][2]

Because generics were implemented using type erasure the actual type of a template parameter is unavailable at runtime. Thus, the following operations are not possible in java:[3]

public class MyClass<E> {
    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
    }
}

Unsigned integer types

Java lacks native unsigned integer types. Unsigned data is often generated from programs written in C and the lack of these types prevents direct data interchange between C and Java. Although it is possible to circumvent this problem with conversion code and using larger data types, it makes using Java cumbersome for handling unsigned data. If abstracted using functions, function calls become necessary for many operations which are native to some other languages.[4]

Floating point arithmetic

While Java's floating point arithmetic is largely based on IEEE 754 (Standard for Binary Floating-Point Arithmetic), certain features are not supported even when using the strictfp modifier, such as Exception Flags and Directed Roundings — capabilities mandated by IEEE Standard 754. Many so-called "Java gotchas" are not problems with Java per se, but problems that are inevitable whenever using floating point arithmetic.[5][6]

Performance

Java's performance has improved substantially since the early versions.[7] Performance of JIT compilers relative to native compilers has in some tests been shown to be quite similar.[7][8][9]

Lutz Prechelt's paper, written in 1999, outlined that, statistically, programmer efficiency and experience has a bearing many standard deviations greater on run-time and memory usage than language choice. This paper specifically uses Java as a basis for the comparison, due to its then-bad reputation.[10] Sun Microsystems has taken considerable trouble to address these problems, and regularly produces white papers on this topic.[11] A more recent study (2003–4) gives Java a comparable performance to C++.[12] However, the validity of this study is disputed.[13]

Java bytecode can either be interpreted at run time by a virtual machine, or it can be compiled at load time or runtime into machine code which runs directly on the computer's hardware. Interpretation is slower than native execution, and compilation at load time or runtime has an initial performance penalty for the compilation.

Security

Adobe Acrobat and Adobe Flash are among the most targeted software for security exploits. In 2010, targeting of Java security exploits increased significantly, resulting in Java becoming far more targeted than Acrobat or Flash.[14][dubiousdiscuss]Microsoft publication This targeting appears to be tied to high numbers of computers with Java installed and the high percentage of computers that have not been updated with Java security updates.[original research?]

Critics have suggested that updated versions of Java are not used because there is a lack of awareness by many users that Java is installed; there is a lack of awareness of many users of how to update Java;, and on corporate computers, many companies restrict software installation and are slow to deploy updates.[14][15]

Other problems include the fact that Java only checks for updates once every 30 days by default, which lengthens the period of time that software installed on computers remains vulnerable. In addition, there is a long standing issue that despite an interface that allows checks for updates to be set more frequently, if the user changes the setting, the setting is not saved. {{citation}}: Empty citation (help)

Among the suggestions made by critics is that users should consider uninstalling Java given the security risk and given the limited number of web sites that require Java to be installed on the browser's computer.[16] Tools like NoScript allow to enable Java selectively only for trusted sites.

See also

Notes

  1. ^ "Generics in Java". Object Computing, Inc. Retrieved 2006-12-09.
  2. ^ "What's Wrong With Java: Type Erasure". 2006-12-06. Retrieved 2006-12-09.
  3. ^ "Type Erasure".
  4. ^ Owen, Sean R. (2009-11-05). Java and unsigned integers "Java and unsigned int, unsigned short, unsigned byte, unsigned long, etc. (Or rather, the lack thereof)". Retrieved 2010-10-09. {{cite web}}: Check |url= value (help)
  5. ^ Kahan, W. (1998-03-01). "How Java's Floating-Point Hurts Everyone Everywhere" (PDF). Retrieved 2006-12-09. {{cite web}}: Unknown parameter |coauthors= ignored (|author= suggested) (help)
  6. ^ "Types, Values, and Variables". Sun Microsystems. Retrieved 2006-12-09.
  7. ^ a b J.P.Lewis and Ulrich Neumann. "Performance of Java versus C++". Graphics and Immersive Technology Lab, University of Southern California.
  8. ^ The Java is Faster than C++ and C++ Sucks Unbiased Benchmark
  9. ^ FreeTTS - A Performance Case Study, Willie Walker, Paul Lamere, Philip Kwok
  10. ^ Prechelt, Lutz (October 1999). "Technical opinion: comparing Java vs. C/C++ efficiency differences to interpersonal differences". Communications of the ACM. 42 (10).
  11. ^ "Java SE 6 Performance White Paper".
  12. ^ "Benchmarks".
  13. ^ "Java vs C++".
  14. ^ a b "Researchers Highlight Recent Uptick in Java Security Exploits".
  15. ^ "Have you checked the Java?".
  16. ^ "Java: A Gift to Exploit Pack Makers".