[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: What Java did right (was Re: Y Store now C++)

I've spent a lot of time recently thinking about what java did right.  Here
are my conclusions.  Some of these echo points made by Eric Kidd in his
very nice analysis.  Disclaimer: java is *far* from being my favorite
language; I much prefer lisp/scheme and ML/ocaml.

First of all, despite what some people think, java really *did* do a lot
right, and not just in the sense of marketing.  The entire java environment
does make a lot of kinds of application development easier.  So what are
these issues?

-- Libraries, libraries, libraries

There is no code easier to write than code that has already been written.
I am very impressed by the size and depth of java's standard libraries.

-- Feature set

Java's feature set was very carefully chosen.  The single-inheritance OO
paradigm with interfaces makes it pretty easy to organize libraries (as has
been known for a long time with Smalltalk).  Support for threads makes
certain kinds of programming much easier.  Garbage collection and array
bounds checking make many kinds of programming *much* easier.  Static
typing catches a lot of errors.  Serialization and reflection are very
useful as well.  I don't know of any fundamental features in java that
don't have a compelling reason to be there.  Of course, there are still
many missing features ;-)  My impression is that java was in many ways
designed to be the minimal language that could support the kind of
libraries that java has.

-- The runtime environment, portability, and safety

To get GC and platform-independent threads, you need a runtime
environment.  Java offers what (to the programmer) is the *same* runtime
environment across platforms.  Errors that would cause core dumps in C/C++
cause a stack trace in java, which at least helps you find the problem.

-- Efficiency

With JITs, java can often produce code that is no worse than 2-3x slower
than comparable C/C++ code (sometimes better).  There are a *huge* class of
apps for which this is good enough.  In fact, the number of apps that
really need maximum speed is pretty small.

-- Packaging

After having suffered through one too many configure/make/make install
nightmares on Linux caused by nests of conflicting dependencies (try
installing Gnome from source if you want a pleasant time), I can really
appreciate the effort that went into packaging in java.  Installing a java
application is almost trivial compared to installing C programs.

-- Familiarity

Hey, I could care less about C-like syntax, but apparently this is a Big
Deal for a lot of people, and java is comforting to them.

I'm sure there are other things, but this is what comes off the top of my
head.  The point is: if you're developing a new language, this is the bar
that you are going to have to reach, or people will not take the language

Note that I *didn't* claim that the java language is well-designed, because
I don't think it is, at least not at a low level (too kludgy, too many
special cases, too much overloading of keywords, too many missing features,
etc.).  But clean design is not the be-all and the end-all.  Whether a more
elegantly designed language could fill the same space as java is an
interesting question.