When James Gosling isn't preaching Java's virtues, he spends his days in a quiet corner office at Sun Labs, dreaming up new ways to help programmers manage complexity. With the Star Trek Borg mask he wore at a prior JavaOne keynote staring down from a shelf, Gosling spoke to JavaWorld's Bill Venners about current programming trends, and his views on the design and construction of software systems.
Bill Venners: If Java exists on so many cell phones and smart cards, why does it seem like almost everyone does server-side software with Java?
James Gosling: I think that's a North American-centric observation. If you go to conferences in North America, people only talk about enterprise software. But I've been to Java events in Europe and in Japan lately, and nobody talks about enterprise software.
Venners: What are they interested in?
Gosling: It's devices, cell phones, how you build the whole end-to-end thing. It would have been eye-opening for North American journalists to go to the recent JavaOne conference in Japan because it was hard to find enterprise anything. There was embedded stuff, real-time stuff -- some goofy, some just amazing. They've got this thing about computation everywhere.
There's a core where enterprise software goes, but it doesn't make sense unless it's talking to something else, the stuff on the fringes. You need an end-to-end attitude before the pieces make sense.
Venners: I recently dusted off Donald Knuth's The Art of Computer Programming (Addison-Wesley Pub Co., 1998; ISBN: 0201485419), which extensively covers algorithms. It struck me as funny that of all the work I've done in my career, I've rarely done hard-core algorithm design. Do you think algorithms are the art of computer programming, or has something changed since the '60s and '70s?
Gosling: Whether you're doing intense algorithm design or not, I think computer programming is always an art. Many people don't understand how to put software pieces together when performance counts, or understand a software piece's performance characteristics -- how to reasonably analyze what does what.
People rarely ask: "Could I do it a faster way?" They'll layer APIs 10 deep. You'll see these 10- or 100-levels-deep call stacks and say, "Oh my God!" These people lay abstractions upon abstractions upon abstractions. They build things out of, in some sense, an accidental complexity that is mind-boggling.
Venners: You once said you were flabbergasted that so many people get into software development without taking an algorithm analysis course. You said the systems people build limp along on bad design. Would that be bad algorithm design, or bad object-oriented design, or what?
Gosling: Oh, it's bad everything design. Bad algorithm design comes from not appreciating how things work. Say you're adding stuff to a table or an array, and you want to grow it. Do you make it 10 bytes larger each time, or 10 percent larger each time? That sounds like the same thing. But if you make it larger by 10 bytes each time, the performance is quadratic in the number of bytes you add. If you increase the length by 10 percent, instead of 10 bytes, it goes from being quadratic to being linear. It's a simple distinction.