Subject: Why Java?
Date: Tue, 13 Oct 1998 16:20:30 -0400
From: David Lee Matuszek
Organization: Lockheed Martin Mission Systems
Java is now my language of choice for practically everything.
That being the case, I thought I'd share some of the reasons
with family and close friends.
The best thing about Java
I enjoy learning new languages, when they have something new to
offer me in return: new insights, new ways of looking at the
programming process, new capabilities. I don't enjoy learning a
new language when it is just old ideas wearing a new syntax.
Java doesn't give any new insights or approaches, unless O-O
programming is new to you (and Smalltalk still does that
better). The language itself doesn't give much in the way of
new capabilities, except perhaps for the incremental improvement
in error handling that the try/catch statement provides. But
Java isn't just a language; it's a huge collection of packages,
each providing capabilities in a form that is readily accessible
to me, the programmer, with relatively minimal effort.
Java doesn't necessarily make any of this easy, but it does
bring it together under one roof, so to speak, so that you don't
have to learn disparate chunks AND learn how to put them
- java.awt lets me construct simple GUIs without a lot of effort
(although a visual tool is still better). The Swing package,
new in Java 1.2, should let me construct GUIs that even look
- java.applet lets me put programs on Web pages (although
Netscape 4.05 doesn't yet understand Java 1.1. Grrr.)
- java.net lets me do networking. I've used sockets before,
didn't like it, don't remember how anymore.
- java.sql lets me access databases. That's something I'm not
fond of doing in the best of circumstances, but that's my
next assignment, and I think Java will help a lot.
- java.beans should let me create "embeddable, reusable
components." There's a lot of hype supporting beans; I don't
personally have a good feel yet for how useful beans will be,
but I'm hopeful.
- java.lang.reflect gives me the ability to examine and
interact with other programs in ways that were never possible
before; I still don't grok all the implications, but I'm
looking forward to exploring them.
- javadoc lets me produce professional-looking documentation
easily. More important, it will help shield me from having
to produce documentation in yet another gawdawful
idiosyncratic "standardized" format imposed by bureaucrats.
It looks to me like I can spend the next couple of years
expanding my programming horizons (at a faster rate than I have
done in a long time) and still be within the Java umbrella. I
like that a lot.
Why not C++?
Well, C++ is object-oriented (or at least it CAN be), but it's
still the most butt-ugly language I've ever tried to use. C++
was a brilliant political achievement, in that it got all those
dyed-in-the-wool C programmers to sample O-O programming, but
it's time to get past that.
C++ (1) has a choice of object libraries you can use, so you
have to learn new libraries every time you change projects,
(2) has some very awkward kludges to make it upward compatible
with C, and (3) still leaves memory management up to the
programmer, thus ensuring a neverending supply of bugs.
The second-best thing about Java
It's a hot language. Everybody loves Java. This has the strong
practical benefit that I get to use it occasionally. No matter
how much I might prefer, say, Haskell, I never get to use it.
The third-best thing about Java
Java is our last best hope to cleanse the world of C++.
Other good things about Java
The more I use Java, the more I like it. This is a good sign;
I've had the opposite experience with, to pick a random example,
Software reuse really is important. You can save a lot of time
by not continually reinventing the wheel. O-O programming, for
reasons I won't go into here, gives us our best hope yet for
reuse. Java is an O-O language; it's not unique in this regard,
but that's still a good thing about it.
Java is free. AND it comes with a very large, free library of
Design Patterns. Design Patterns are the silver bullet of the
late 90's, the thing that will solve all our programming
problems. Yeah, I don't believe that either, but every little
bit helps, and Design Patterns do appear to be Good Things.
Write once, run anywhere. Well, almost. Real Soon Now.
Bad things about Java
I never much cared for C syntax; Pascal is easier to read. A
Pascal-like syntax for Java would not change Java in any
essential way. Oh, well.
In particular, since Java is not in any sense upwardly
compatible with C, they could have fixed the switch statement so
you don't need a break in every case. They didn't.
Java isn't simple. Anyone who tries to tell you that Java is a
simple language is comparing it to C++.
Java still isn't as much fun as Prolog or one of the purely
The Macintosh OS originally allowed 511-character file names;
somewhere around System 3 they cut back to 31-character file
names. This is a Macintosh problem, not a Java problem per se,
and there are workarounds, but it does make "Write once, run
anywhere" a little problematical. The Swing set, in Java 1.2,
is especially prone to long file name problems.
Inner classes are good things, but they are an afterthought, and
not well implemented. I still haven't learned all the gotchas.
Java will never be as fast as a purely compiled language.
The bad news
It appears to be the case that Microsoft views Java as a threat,
and is trying to kill it by "improving" it in ways that work
only on Wintel machines. It's a good strategy, and probably
benefits those of us who have no contact with non-Wintel
machines; but that's not me. I personally fear monopolies,
particularly in my own field, and I hope that the Department of
Justice prevails; and if the DoJ prevails, I hope it prevails
for the right reasons.
The bottom line
I guess I'm urging everyone to jump on the Java bandwagon,
insofar as possible. For my Wintel friends, I urge the same;
just be sensitive to the differences between the code produced
by MS tools such as J++ and the "100% Pure Java" advocated by
Written October 13, 1998 by
Reformatted for the Web May 27, 1999.