Evan Finally Drinks Coffee — almost

It's been a running joke during my career that I am the only programmer in Northern California who doesn't drink coffee. Not true, of course — I know at least one other, but there's something suspicious about a programmer who doesn't use caffeine to fuel those late-night code parties, isn't there? The reason is simple, and actually tripartite — I don't like the way coffee tastes, caffeine has a lesser effect upon me than on most people, and coffee makes me physically ill if I drink it (at least it did the first time, and there's never been a second — projectile vomiting is a powerful disincentive to try again).

But there's no question that the world of bits and bytes runs substantially on coffee, and I've often felt, well, slightly left out that I didn't participate. The advent of a new computer language a few years ago called Oak made it even worse.

Never heard of Oak? That's because there was already a language called Oak, so they had to rename it. They call it Coffee now — no that's not it, what do they call it? Oh yeah — Java. They call it Java (there must be a movie title in there, a programmer/western, or maybe a volcano adventure).

Anyway, I don't drink coffee, so many of the coffee-centric jokes around Java leave me un-amused or completely bewildered. However, Java has the biggest hype machine working (when was the last time you read about C++ in The Wall Street Journal?), and in the "real world" of Adobe there's a certain interest. So I have had to acquire a nodding acquaintance with, you guessed it, Coffee — er, Java. I have to admit a certain reluctance on my part to do this, mostly because of the hype (I'm an Erisian at heart, and like to run counter to the most obvious trends). In fact, the hype on Java had gotten to the point where my third reason for not liking coffee was beginning to apply to Java.

But mere physical discomfort never stands in the way of a true Techno-Geek, so I scrambled around the 'Net, found several JDKs, dug up a few books, and I was on my way.

JAVA IN A NUTSHELL

Java is an Object-Oriented (yawn!) language extremely similar to C++. In theory it is superior to C++ in a number of ways, mostly because Gosling and Company at Sun had the example of C++ to learn from. In practice it is more fully OO than C++ because it doesn't derive from C nor attempt to be backward compatible with C or C++. In theory it is fully portable between platforms/systems ("Write Once, Run Everywhere") because it is interpreted and the binary output is carefully defined by the standard. In practice it is more like "Write Once, Debug Everywhere" because the JVM (Java Virtual Machine) implementations on different platforms vary. Not to mention the disagreement between Sun and Microsoft about this detail and that detail (see your local newspaper for details, if you've missed this soap opera). Because it is interpreted Java applications tend to be somewhat — stately (thanks to the anonymous Adobe employee in the elevator who supplied this term). As JIT (Just-In-Time) compilers and native code compilers become more widespread, the performance will, of course, improve.

To a C++ programmer, Java is mostly just a new dialect, and in fact it's possible to write small programs which are capable of being compiled either by Java or C++ — a trick on par with the typical entry in a C Obfuscated Code contest, but one which reminds you how closely related these two languages are.

Just Java 1.1 and Beyond, Third Edition
Peter van der Linden
Prentice Hall, PB, 660 pp.
ISBN 0-13-784174-4

Someone at a computer show told me there were "thousands" of books out on Java. I think that's an exaggeration, but probably not off by an order of magnitude. I've looked at more than ten in a short time, and picked out two that I like very much. This one is, so far, the best*.

Just Java does a good job of covering the basics, including a nod to explaining OO in a chapter, selecting an ISP and browser, and other non-language "fluff". The language sections start with basic types and work through statements, objects, visibility, packages, arrays, exceptions, and threads. There is usable information on applets, AWT, graphics programming, file i/o, networking, and a preview of Swingset. While some of the information is out of date, everything I tried worked, even if currently deprecated.

I found the examples and explanations in this book to be superior to most of what I was reading on Java and to my experience of programming books in general. I actually had occasion to take one of his networking examples, modify it slightly, and use it!

Van der Linden's writing style is one to which I would aspire. He's clear, reasonably terse, and something of a curmudgeon. He can't go more than a couple of pages without taking a dig at someone or something — often C++, sometimes Java, sometimes something else. It lightens up the reading, and it helps that I agree with most of his dislikes. YMMV. All the chapters include a section of Light Relief, and most have Exercises and/or additional References. How many programming books do you have that include origami instructions for a dive-bomber?

Since there are so many volumes available on Java, it's tough to walk into a bookstore and select one. It's even harder if you're using a service like amazon.com and shopping online. This is a good book for an experienced programmer to use for learning Java. I think it would also serve a novice well, but probably as a second book — the first one should include lots of repetitive examples to promote retention.

* "best" is a question-begging term. If I were attempting to write or debug a JVM, or investigating an obscure language defect I would not use this book. I would go directly to the SunSoft books published by Addison-Wesley. This is a good book for learning the language.

Evan Robinson is an Engineering Manager in the Professional Graphics Division at Adobe Systems, Inc., where he manages a central technology and resources team (for which he is currently hiring). Previously he was Director of Games Engineering at Rocket Science Games, and before becoming a manager he was a consultant, programmer, technical director, and game developer. You can email him to talk (well, OK, type) about books, software, development, farming, learning to parent or the meaning of life.

Copyright © Evan Robinson. All Rights Reserved.