Java Is Not My Favourite Language.

I think I had a passing look at Java in 1995. Certainly in late 1996 when I joined Cognotec, one of the first things I did was a proof-of-concept toy in Java which was effectively the company's first adventure in providing an Internet-based client. We'll let pass the fact that 4 years later, they're still apparently working on the idea, and have, as far as I know, long since abandoned Java as the platform for same. By the time I left the company in 1998, I had gotten thoroughly disillusioned with any of the original promises of the language. It wasn't cross-platform in any sense - stuff that worked in Netscape/Windows didn't work in Netscape/Solaris, and neither version would work in Internet Explorer. At least one version of Netscape's JVM would crash if you disconnected an Internet socket while it wasn't looking. None of the provided toolkits were of any practical use for doing simple UI things like intelligently resizable panels or combination list/text boxes, and the stopgap measures were things like IFC and Swing which were busily marching off in opposite directions trying to establish themselves as THE standard, while Microsoft were headed in a third direction with the intention of rendering Java a historical footnote in the so-called Browser War. Guess who won that fight?

My next encounter with Java was as the main interface to a firewall. Both the firewall and the interface sucked, especially if you were stupid enough to try and use a Macintosh to run the configuration interface. Hey, guess what. The damn office was full of Macs, what with being a publishing house and all, and finding a working Windows machine that hadn't spontaneously bitrotted to death was an almost weekly chore.

After that I managed to avoid Java for the best part of two years, although I did do some JavaScript work when I transferred to StepStone. That was mildly sickening, but closer to my style of programming.

I started my current employment as a sysadmin, and promptly turned into an Oracle Internet Applications Server developer due to a slight shortage in the development department. Working on JavaBeans and JSP for while was okay, but then I had to do some work on an image viewer, and applet was the only practical way to go. And after a particularly frustrating couple of hours spent paging through manuals and trying assorted stupidity with code, I fired the following email off to the Geeksrv:

Why oh WHY does Java have such a problem with converting between apparently similar classes? I'm trying to do some simple image manipulation, so the obvious thing to do would be load an Image and use its getPixel( x, y ) method to access the pixels, except that IT DOESN'T HAVE A getPixel() METHOD. So. I try using a BufferedImage instead, but you can't create a BufferedImage from an Image, i.e. there's no bar = new BufferedImage( Image foo ) kind of thing available. Then there's the whole FilteredImage tree, none of which are subclasses of Image; there's MemoryImageSource, which is an /ImageProducer/, not an Image... I wrote this code in about five lines of Perl, using the GD module. Why the hell does Java keep using data abstraction to stop me from doing anything useful?


There's so much more about the language that irritates me; in particular, library routines that have quite obviously been borrowed from libc or some other standard library, but then have had their interfaces mangled. substring, for example, in the String class - its parameters are start pos and end pos - 1. Non-intuitive for beginners and veterans alike. Utterly, UTTERLY braindead. Then there's the similarly named functions that take parameters in different orders; similarly-functional functions (oh, sorry, methods) with wildly differing names; and what moron came up with the Enumeration class? hasMoreElements? hasMoreCharactersThanIfWeDidThisInCOBOL, more like.

Of course, as a C and Perl programmer by preference, I'm spoiled by the expectation that a language should be powerful, consistent, and in Perl's case, intuitive once you've gotten a grasp of the local dialect. The amount of time I have to spend browsing Java API documentation attests to how far the language is from this last, most crucial of features. After all, if I have to keep consulting a manual, how the hell am I ever going to get anything done?

Yes, I solved the image manipulation problem, with the help of a pointer that JC dug out for me after the above ranting. No, C is not intuitive or, in a lot of places, consistent. Yes, I do have plenty mental storage space, but I expect to fill it with algorithms and program state, not waste it on figuring out which developer was given the task of developing this class and thus guess at the likely order and type of parameters.