So the past returns to become my future. A project heaves into view, and it’s Java-based. Heavily so. J2ME, to be precise. And so the far end of the shelf of books next to me gets dusted off and a pile of Java references thump onto my desk. I gaze longingly at the well-used set of Python books; farewell, Lutz, adios, Beazley.
Actually, it’s not as bad as that, as well as being worse. The Python coding will continue, since the entire web-site is Zope-based, and all the utility code that uploads, downloads, munges, packages and files the serial numbers off data is all in Python. That’s why it’s not that bad. What’s worse is:
- I’m going to have to get my head back into Java-mode
- I’m going to have to switch between two languages on a daily basis
I’m sure many of you have been there; the realization hits you that huge swathes of the syntax of a given language have settled in your fingertips rather than in your head. Semicolons magically appear at the end of statements that don’t need them. Braces flicker in and out of existence. And if you use the same editing environment for more than one language… you lack even visual cues as to what the hell you’re supposed to be writing in. Switching languages, when you’re a deep hacker, is a pain. And I humbly submit that this simple fact is hugely responsible for the continuing prevalence of C and C++.
You know how it is. You try out a new language; grab yourself an IDE (or even just fire up vi, emacs or notepad) and there it is. A blank page. Waiting for you to create. But you don’t know the words to use. You have to start looking at examples… figuring out the basic idioms of the language. And all the time, nagging at you like an imp sitting on your shoulder, is the knowledge that in a month or so, you’re going to look back at the code you’re writing now and cringe at how naïve and newbie this code you’re writing now will look. Ugh. Thus the continual drive to use the languages you already know; the fear of looking as though You Don’t Know How To Program. Because, of course, you do: it’s part of the deep and fundamental definition of yourself. No wonder people stick to C. They have self-images to cling to.
On the other hand, I already know Java. Or at least, some dormant, swapped-out part of my head does… it’s just that it takes a while to page in that knowledge from whatever slow, offline part of the cortex it’s stashed in. Whilst shifting my Java books, I found my very first Java In A Nutshell. From 1996, before O’Reilly made all their covers follow the animal-print style (this one has some bloke in black and white pyjamas – I think it’s supposed to be a referee, if you’re American). It’s completely annotated with notes, covered in post-its… once I had my head so deep into Java that I had trouble with C. But that was with Java 1.0. These days, of course, we’re in Java 2 land. I fish out the newest Nutshell… Java 1.1. I sigh, and hie me to Amazon for an updated copy.
The extra-super-interesting fact about this project is… it’s mobile. Therefore J2ME. For those who haven’t encountered this set of platform/configuration/profiles, let me assure you that if you thought Java was for big, sprawling, memory-hungry enterprise stuff, J2ME is about as far as you can get from there. We’re talking about midlet sizes of 64k, total. We’re talking about platforms with no floating point support at all, and where releasing resources is vital, lest the tiny RAM space available overflow. We’re talking about trading off a compressed file format against the size, in bytecodes, of the code required to decompress it. And before you say it, I will; it’s like going back to the 1980s again, and writing for those single-board microcomputers where having BASIC was a luxury. Yowza.
So at one and the same time, Java is more powerful than I remember… and vastly more limited. What brave new world that has such contradictions in it! Now, which are the curly brackets again?
 To make this worse, I remember that when I started Pythoning several years back, it took me ages to realise this was happening. A semicolon is a legal statement separator in Python, so there were no error messages or the like to warn me of the lingering Java/C-ism…
 Ages ago, I used the word “whilst” on a progress dialogue, in an X-Windows application. It came up during a demo of the software to some big-cheese American customer (since the demo was in the USA, this was to be expected). After all was shown and explained, he said, thoughtfully: “I like it all, but how come you guys can’t spell while?” It was only then that I became enlightened as to the absence of this word from the American English vocabulary. Go figure.