The Top 10 Ways to get screwed by the "Java" programming
Last modifiedMarch 28, 1999.
To get on this list, a bug has to be able to cause at least half a day
of futile head scratching, and has to be aggravated by design flaws in
the Java programming language. Java is a good language, but far
from perfect. Compare this list with the compantion Top Ten ways
to be Screwed by "C" page. To revisit the horrors of the past.
Better languages allow fallible programmers to be more productive.
Java is not cast in stone, so perhaps some of these complaints can be
addressed, if not in Java then in Java2. In any case, whether
fixed or not, awareness is a big step toward avoidance; so read on!
- Know your classes. The
rules for locating the classes to use are complex, and not consistant
from one environment to the next. Consequently, it's easy to be
confused about which classes are actually being used. And if you
don't knwo what classes are being used, you have no hope of
understanding your program's behavior. Here are some aggrevating
Thread with wild abandon, and without
a safety net. Java virtually requires you to use 3 or more
threads for even a very simple program (threads for paint, event, run),
but provides only the most basic synronization primitives. I
wrote about this problem at some length in my Javaworld
- Some versions of appletviewer lookf for "jars", some look for
"zips", some loop for neither. JDB looks never looks for jars or
zips, even when the corresponding versions of appletviewer without jdb
do. Worse, no programs seem to notice archives that haven't been
updated. Consequently, archive files tend to be a booby trap
- if "." is included in CLASSPATH, you can get different results
depending on the current directory is. I suspect some java
implementations give you "." whether you want it or not. Some
java implementations are not cautious enough about picking class files
with the correct name, but when the internal class name is evaluated
relative to the current element of CLASSPATH, can give an incorrect
actual class name.
- Both Netscape and Internet Explorer will use classes found
relative to your local CLASSPATH in preference to classes downloaded
from remote web sites. This "feature" makes it difficult to debug
classes installed on remote sites, since you must be very careful to
"hide" your local classes from the browsers.
Reserved for future expansion. Send email to firstname.lastname@example.org with your