Criticism of Java: Difference between revisions

From Wikipedia, the free encyclopedia
Content deleted Content added
Proposed merge → being merged.
Merge complete. Replaced with redirect.
(6 intermediate revisions by the same user not shown)
Line 1: Line 1:
#REDIRECT [[Java (programming language)]]
{{Merging|dir=into|Java syntax}}
{{Merging|dir=into|Generics in Java}}
{{Lead too short|date=March 2009}}
A number of criticisms have been leveled at [[Java (programming language)|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 ===
{{See|Generics in Java}}
When [[Generic programming|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 [[Generics_in_Java#Type_erasure|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.<ref>{{cite web | url=http://www.ociweb.com/jnb/jnbJul2003.html | title=Generics in Java | publisher=Object Computing, Inc. | accessdate=2006-12-09}}</ref><ref>{{cite web | url=http://www.safalra.com/programming/java/wrong-type-erasure/ | title=What's Wrong With Java: Type Erasure | date=2006-12-06 | accessdate=2006-12-09}}</ref>

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:<ref>{{cite web|url=http://java.sun.com/docs/books/tutorial/java/generics/erasure.html|title=Type Erasure}}</ref>
<source lang="java">
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
}
}
</source>

=== Unsigned integer types ===
Java lacks native [[Integer (computer science)|unsigned integer]] types. Unsigned data is often generated from programs written in [[C (programming language)|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.<ref>[http://darksleep.com/player/JavaAndUnsignedTypes.html Java and unsigned integers]</ref>

== 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 <code>[[strictfp]]</code> 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.<ref>{{cite web | url=http://www.cs.berkeley.edu/~wkahan/JAVAhurt.pdf | title=How Java's Floating-Point Hurts Everyone Everywhere | first=W. | last=Kahan | coauthors=Joseph D. Darcy | format=PDF | date=1998-03-01 | accessdate=2006-12-09}}</ref><ref>{{cite web | url=http://java.sun.com/docs/books/jls/third_edition/html/typesValues.html#4.2.3 | title=Types, Values, and Variables | publisher=Sun Microsystems | accessdate=2006-12-09}}</ref>

== Performance ==
{{See|Java performance}}
[[Java performance|Java's performance]] has improved substantially since the early versions.<ref name="LewisNeumann">{{cite web|url=http://scribblethink.org/Computer/javaCbenchmark.html|title=Performance of Java versus C++|author=J.P.Lewis and Ulrich Neumann|publisher=Graphics and Immersive Technology Lab, [[University of Southern California]]}}</ref> Performance of [[JIT compiler]]s relative to native compilers has in some tests been shown to be quite similar.<ref name="LewisNeumann"/><ref>[http://www.kano.net/javabench/ The Java is Faster than C++ and C++ Sucks Unbiased Benchmark]</ref><ref>[http://research.sun.com/techrep/2002/smli_tr-2002-114.pdf FreeTTS - A Performance Case Study], Willie Walker, Paul Lamere, Philip Kwok</ref>

In a paper written in 1999 by [[Lutz Prechelt]], it is 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.<ref>{{cite journal | url=http://portal.acm.org/citation.cfm?id=317683 | title= Technical opinion: comparing Java vs. C/C++ efficiency differences to interpersonal differences | first=Lutz | last=Prechelt | journal= Communications of the ACM | volume=42 | issue=10 |date=October 1999}}</ref>
[[Sun Microsystems]] has taken considerable trouble to address these problems, and regularly produces [[white paper]]s on this topic.<ref name="J6White">{{cite web|url=http://java.sun.com/performance/reference/whitepapers/6_performance.html|title=Java SE 6 Performance White Paper}}</ref> A more recent study (2003&ndash;4) gives Java a comparable performance to [[C++]].<ref>{{cite web|url=http://scribblethink.org/Computer/javaCbenchmark.html|title=Benchmarks}}</ref> However, the validity of this study is disputed.<ref>{{cite web|url=http://www.freewebs.com/godaves/javabench_revisited/|title=Java vs C++}}</ref>

[[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.

== See also ==
* [[Comparison of Java and C++]]
* [[Comparison of Java and C Sharp|Comparison of Java and C#]]
* [[Comparison of the Java and .Net platforms]]

== Notes ==
{{reflist|2}}

==External links==
* [http://www.gnu.org/philosophy/java-trap.html Free But Shackled - The Java Trap], an essay by [[Richard Stallman]] of the [[free software movement]] (dated April 12, 2004)
* [http://www.stsc.hill.af.mil/CrossTalk/2008/01/0801DewarSchonberg.html Computer Science Education: Where Are the Software Engineers of Tomorrow? ] (dated January 8, 2008)
* [http://www.google.com/Top/Computers/Programming/Languages/Java/Criticism/ Java Criticism]
{{Java (Sun)}}

{{DEFAULTSORT:Criticism Of Java}}
[[Category:Java programming language]]
[[Category:Criticisms of software and websites|Java]]

[[ja:Javaに対する批判]]

Revision as of 21:41, 22 April 2010