Eckel thinks in Java

An interview with Thinking in Java author Bruce Eckel

JavaWorld:Hi, Bruce. Congratulations on winning JavaWorld's Editors' Choice Best Book Award for Thinking in Java, Second Edition.

Bruce Eckel:Yes, that's great.

JavaWorld:How did you get started with computing and writing?

Bruce Eckel:I took my first programming class in high school. They had one of those old teletypes where everything is upper case, and a long roll of ASR33. Then, in college, I took a course that covered various different programming languages. It was the only time I ever programmed in Fortran and COBOL. I started as a journalism major, which is what I'd done in high school, but decided I needed a challenge and changed to physics. My graduate degree was in computer engineering. Through all this, I was still working on college newspapers, staying involved in writing and publishing.

After I graduated, I worked for Tom Keffer at the University of Washington. The work that we did there was funded in such a way that the work became public property. He eventually used some of the core of that work to start Rogue Wave.

During all this time, I missed magazine publishing. So I started writing for a little magazine called Microcornucopia, which not too many people remember. But those who do remember it very fondly.

I don't really write for magazines anymore. When I started writing books, I discovered that when you write for a magazine, people remember the article and the name of the magazine. When you write a book, normally they remember the author. So I discovered that was a more memorable thing to do.

JavaWorld:What gave you the idea of giving your books away for free?

Bruce Eckel:Well, I had published a number of books by that time. I self-published my very first book, which was a collection of articles from Microcornucopia. That was a deeply satisfying process.

I'd been working on Thinking in Java for a while, but I was not looking forward to going through the same tedious publishing process. Publishers are typically kind of -- well, it's a very old business. There are a lot of antiquated processes in place so that it just felt like battling uphill.

The Internet was getting more and more popular, and a friend of mine had a server, on which he'd given me as much space as I wanted.

One of the things that went through my head was maybe nobody would ever buy the book. Then I had started doing my own seminars. I put the book up on the Internet so I could get people to come to my seminars because of the book; then it really wouldn't matter if I ever sold a single copy. If they came to the seminars, that would be much more gratifying than if I never got the book published.

Naturally, as these things are often ironic in that way, this is the most popular book I've ever written, by far.

JavaWorld:What's the big difference between the first two editions?

Bruce Eckel:The first edition primarily covered 1.1. I was able to get some early Swing stuff into it, but it was really outdated.

For the second edition, I decided there would be no backwards compatibility with 1.1. I thought, Java 2 is the first time [Sun] has more or less gotten the language right, so I would just focus on that. I would say that's primarily the shift.

Plus, I had gotten more reader feedback. I basically went over every single paragraph and rewrote everything. I took out some of the early stuff that I had done with CPIs and some C++ examples, where I was still on a pretty steep learning curve.

Most of the direct benefit from putting the book on the Internet is all the wonderful user feedback. As time has passed, there's so much user feedback that it has become unmanageable. Bill Venners and I are now working on a system to manage the user feedback much better. So it's the people who gave me the feedback that have made the second edition great.

I still want to do more with the multithreading and distributed computing chapters because there's a lot of stuff that I'm not satisfied with.

JavaWorld:Does that mean there's a third edition coming out?

Bruce Eckel:I am trying to put things in place so the third edition can begin evolving. A lot of that has to do with this feedback system. I'm not trying to cover all of the special cases, new libraries and stuff. I'm really just trying to get the core of the language down and teach it in a way that it brings people on board fairly easily.

That reminds me, the other thing that we did in the second edition of Thinking in Java is we put a CD in the back. One of the other problems we would have at seminars is that people didn't have enough of a C background to understand what is going on in Java.

I thought the solution would be to create a CD that would bring people into just enough C so that they could move on to Java, without getting into all the dark corners of that language (which we're more or less trying to get away from in Java anyway).

I commissioned Chuck Ellison to build and present this seminar and then record it. The CD includes 10 hours of lectures, slides, exercises, and solutions. That way, people can get up to speed on the fundamentals of C.

JavaWorld:Shifting focus a little, what do you think of the current state of Java? The big conference is this week where they're going to announce many new things.

Bruce Eckel:I suppose the more I learn about the language, the more there are things that annoy me, stuff like the primitives. Part of this is working with Python. In Python, everything is an object. Whereas in Java, [Sun] has said, "Well, everything's an object -- oh, except primitives will always have to be nonobjects." Then you have this really awful wrapper. What [Sun] should have done is say, "Everything is an object, and if you need to use special case primitives for speed, you can." The designers should've had this core consistency and an escape clause.

Then there are other things, like putting hash code in an object, which I don't have any trouble with because that's a common thing to do. Yet there's no compare function in an object. We have to patch it in the new collections.

Another thing I've seen over Java's evolution is that the behavior of threading seems to subtly change with each release, yet [Sun] doesn't really mention it. As time passes, I get the impression that the threading design may have been very much like the original AWT. Sometimes I get a new version of Java and all of a sudden my threading program seems to be running differently, something changed. I just wonder if, at some point in the future, [Sun] might say, "Well, we're going to change everything about threading."

JavaWorld:Have you been reading what Allen Holub has been writing about the problems with the threading model?

Bruce Eckel:No, but I am always interested in what Allen says. He has the kind of mind that would be able to delve into that and figure it out.

One of the things that I did want to comment on is libraries. When Bjarne Stroustrup created C++, I remember him saying that he considered the most important aspect of productivity was being able to use libraries. The problem with C++ is that although library use is not too hard, library creation is incredibly difficult. It still is. As a result, we don't see a lot of libraries in C++. In Java, library creation is much easier. As a result, we see this explosion of libraries, and a lot of very good ones.

JavaWorld:You're not attending JavaOne this year?

Bruce Eckel:No, I'm not going to JavaOne. I think JavaOne is a nice conference, especially if you don't go to a lot of conferences. But if you do, you have to ask yourself, "What am I going to get from it?" There's a lot of energy and everything, but I get so much energy from doing my own seminars that it's hard to compare.

JavaWorld:Do you get any spare time to read nontechnical books?

Bruce Eckel:When I read, typically I read novels. Eventually, that's what I want to write. The first time I went up to Colorado, my goal was to drop all this computer stuff and write my novel. For some reason -- just clearing out my life -- I ended up working on the first edition of Thinking in Java. I got a lot of work done and brought it to fruition. Even if you aren't successful, it's a good thing to do, to take that leap.

JavaWorld:How else do you enjoy your spare time besides spending it in Colorado?

Bruce Eckel:Venners and I teach this Objects and Patterns course and we have a lot of other stuff in common. He convinced me to go on a bike tour of the South Island of New Zealand. In February, we spent three weeks and rode something like 800 miles around the island. This is one of those life adventures that you remember on your deathbed. It was wonderful.

One of the ideas I came up with is to bring it back to technical folks. I went and found the domain name NerdsOnBicycles.com. The idea is that we choose a professional bike touring company that has a sag wagon, which carries your luggage, and if you get really tired, picks you up and carries you to the next location. You don't have to be in super good shape. Since we're all technical folks, we would probably sit around and talk about technology in the evenings or while we were riding. I think we're going to try and do something this fall. We will probably have a theme. The first one might have a Python theme, I don't know.

John Zukowskiis a strategic Java consultant with his company, JZ Ventures Inc. He lectures on Web technologies for Boston-based Northeastern University and writes books on Java. His latest books are Java Collections and the Definitive Guide to Swing for Java 2, Second Edition, both from Apress.

Learn more about this topic

Related: