Remembering Java 1.0

22 Nov 2007

In November 2007, Java is the #1 programming language. Yet for all it's popularity, there are probably an equal number of malcontents. You've heard the issues: that it's excessively verbose, bloated, neither fish-nor-fowl (ie. what is Java's goal? Or what is Java? A language? A runtime?), causes developers to focus on secondary issues and excessive abstraction, etc. Regardless if you agree or not, for now let's pretend all the complaints are valid. If so, then how did this clunky language climb to the top?

It's easy to forget what a revolution Java was when it came out in 1995. Back then C++ barely worked and was slow, you had perl4, a million Unix variants, and you were lucky if you had 90Mhz computer. The number of high quality open source libraries was a lot smaller, and it was always a issue getting them to compile.

The Promise of Java

Here's what I recall when java came out, and how those advantages compare now days

Compiler - Features

Pre-Java Each unix platform had a different compiler than implemented C++differently. So needed either lots of #ifdefs or custom libraries working around compiler bugs

Java One compiler on every platform. Worked

NowC/C++ compilers are relatively mature now. Many scripting languages have replaced C/C++ code.

Compiler - Speed

Pre-Java Compiling the entire application could take hours. ClearCase (source repository) provided a system of pre-compiled source files on a central server to help the speed compilation.

JavaWhen Java came out it was a godsend. The entire application was compiled in seconds or minutes

NowToday, compilers are a lot better and the time to compile is "reasonable".

Basic Types

Pre-Java Different platforms has different sized integer and floating point types, signed and unsigned, with strange casting rules. And different endians, so long term storage was problematic

JavaDouble, Int, Long, Byte. Done.

NowEveryone uses x386 now so endian isn't an issue (haha). Interestingly the big Java champions are IBM and Sun, whose chips use big endian not x386 little endian. Types still are a problem in C/C++ but can be mitigated with good practices.

Basic Data Structures

Pre-Java STL did not work or exist or could not be compiled or were slow. Had to buy libraries since open source versions didn't exist or were not mature.

Java Rich types: strings, vectors, hash tables, etc

NowSTL works and works well, numerous platform libraries (APR, NSPR, GLib), scripting languages.

Basic OS libraries

Pre-Java Every OS had different implementations of libc and posix calls

Java Standardized and worked.

Nowposix compliance is pretty good. Autotools works well. numerous platform libraries (APR, NSPR, GLib), scripting languages

Program Structure

Pre-Java one header file, one source file, each could contain multiple classes or gasp, functions

Java one class, one source file. Everything is in a class. At the time, this was viewed as a great simplification

NowC++ is still the same. Java now supports "inner classes". Not so sure that Java is a better solutions (it's different but it has pluses and minuses

Object Serialization

Pre-Java Custom, or had to buy 3rd party library (if it existed)

JavaBuilt-in, with versioning!

Now for C++ there is Boost, most scripting languages have a native way of doing this and/or JSON

Remote Method Invocation

Pre-Java Horrible CORBA, which barely worked or different versions were incompatible.

Java RMI ! while nobody uses it now (?), at the time, it was considered amazing, as compared to CORBA

NowUse HTTP and/or XMLRPC

Exceptions

Pre-JavaAs I recall, even C++ exceptions were "experimental" or had performance issues due to crappy compilers.

JavaBuilt in, worked. You could get a stack trace!

NowThey certainly work in C++, but not as rich as Java

Threading

Pre-Java

JavaBuiltin, with nice syntax. Current concurrencies libraries are really excellent.

Nowposix libraries work. C++/OS abstraction libraries (boost) make it even easier. Atomic operations can be provided by other libraries. Many scripting languages don't have true threads.

Robustness

Pre-Java Delicate. Easy to core dump.

JavaSolid. (crashes are a very rare event).

NowEasy to make mistakes, but can be greatly reduced by using STL and references not raw pointers. But of course the risk exists. Of course scripting languages provide the same safety.

Memory Management

Pre-Java DYI. Easy to leak. Had to buy tools to find them.

Javagarbage collector!

NowLeaks still exists in C/C++, but by careful engineering, with constructors/destructors you make leaks go away, and by avoid raw pointers. Plenty of free tools to help catch them. Scripting languages of course do this too.

Simplicity

Pre-Java C++ is a complicated language. Perl4's concept of OO was very primitive

JavaJava, when it came out billed as being simple and self-contained. I seem to recall some demo they gave where they printed out the complete java spec and compared it to 3 meter stack of books for Win32. Also I see to recall that 1 line of Java was like the equivalent of 3 lines in C++ or something. At the time, perhaps it was true.

NowWell, C++ is still complicated, no doubt. The STL and other standard libraries are greatly improved too, improving productivity. But Java has exploded, not just in libraries but the language itself. I don't think anyone can say java is a simple language anymore.

Modular

Pre-Java Shared libaries are tricky.

JavaJAR files are simple. You can give someone a JAR file and they can use it instantly

Nownot as much as an advantage. Setting CLASSPATH is still annoying

Documentation

Pre-Java What documentation?

Javajavadoc!

NowNow days, every scripting language has some type of autodoc system, frequently inspired by Java. For C/C++ Doxygen works well.

GUI

Pre-JavaBack in 90s, writing for Unix meant writing for X. The widgets looked horrible. or you could buy a Motif license, which looked a lot better but was buggy. And then how to write something cross platform so it worked on Windows too. And the Win32 was terrifying.

JavaJava's AWT allowed mere mortals to write cross platform GUIs.

NowOf course now for Java there is AWT, Swing, and SWT. And on the other side there is wxWidgets and others.

Java Today

As you can see when it came out, Java was quite compelling, but those advantages don't always hold anymore.

So what is Java good for now? This is an easy question to answer for just about any other language, but for some reason it's hard to answer with Java. It's not that I'm saying Java is bad, and it certainly has some good features, libraries, and applications, but what does it excel at that other languages have a hard time doing? What type of project would you use it for if starting from scratch (and besides the fact you know it already).