As the father of Java, James Gosling gets a lot of love from the millions of developers who use the language around the world. Today, however, he programs robots that swim in the ocean. We caught up with him to discuss the early days of Java.
SD Times: How did your work on Java start?
Gosling: This started for me in late 1990s. There was a group of us at Sun who kept looking at the way the world was going, and one of the things that was really apparent was there were a lot of people outside the computer industry using digital systems inside their jobs. We looked at everything from control systems for elevators, locomotives, home electronics, to early cell phones. They all had processors in them. Pretty much the whole computer industry was ignoring that, and they were largely ignoring the computer industry.
We thought this was wrong and somewhat weird. So we went off and spent some time studying the way that industry works. We went on a bunch of road trips to consumer electronics manufacturers all over Europe and Asia. We came up with this sort of big feeling there was this collision that was just barely starting to happen.
When we talked to the consumer electronics folks, they were sort of reinventing computer networking in a really bad way. They were pretty much repeating the experiments people in the computer science world had done 20 years before. Many of the things people were doing were doomed.
By the early 1990s, all the Internet protocols, like TCP/IP, were pretty well established. At the same time, there were attitudes the consumer electronics world had. To help us understand that more (being a group of engineers), Scott [McNealy] our CEO, was really good about setting up people to go off and explore stuff. There were originally like three or four of us, and it expanded to a dozen or so. We built a prototype device as a way of helping us learn what the issues were.
What types of issues were keeping electronics manufacturers from moving faster?
One of the issues that came out really strongly very early on was that the way we addressed programming itself was causing cost issues with many of the manufacturers. It was causing issues with the business plan for consumer electronics. My part of the project was to go off and think about the programming methodology around this sort of highly networked system. When I started, I was thinking, “This will just be C++ with some fixes.” But then it kind of grew, and the fixes became much more extensive, and so that’s really the only part of the project that survived: the programming tool.
The rest of the Green Project was really important to provide the motivation for a lot of the issues in Java. The really lucky part was this collision between computers and the consumer industry, so a lot of this really showed up. The large-scale networking really has happened. Sun Microsystems, at the time as a company, networking was the central concept in everything we did.
So Java was sort of for the Internet of Things 1.0?
If you look at a lot of the back-end systems people use in Internet of Things, pretty much everything that scales is a Java application, or one of the JVM languages. One of the things that’s sort of weird about Java is that it’s a two-level language. There’s the JVM and Java on top of it. People have built literally hundreds of languages based on the JVM.
That one, oddly enough, was in my mind because when I designed the virtual machine, I wanted it to be reasonably flexible because there are a lot of motivations behind doing that. That could give it the flexibility for other languages on top. The trap people fall into is if you try to do one of these virtual machine designs and say it must be possible to write any programming language on top of that design. That’s where you end up failing and you end up recommitting the major mistakes of computer architecture.
Have additions to the language made it even easier to build on top of the JVM?
Things like Invoke Dynamic isn’t about letting you do things you couldn’t do before. It’s about making them more efficient. When you’re a small team, there are a lot of things you say “later” to.
What do you think of how Java has evolved over the years?
There are a bunch of other issues back when it was being finalized in 1995 or 1994, getting ready for first public launch. There were some really important issues that needed to be addressed, things like generics and lambdas. We had lots of really heated discussions. Bill Joy and I argued this for hours. The issue for me was, on the one hand, these are topics that are well covered in computer science research at the time and were known to be really good ideas and important things to have.
The problem was if you surveyed all the world’s programming language designers and asked them what they thought the right answer to many of these problems were, you would get far more answers than there were languages. There was no real consensus. There were a whole lot of ways known to do it wrong, and which one was right was not clear.
As sort of a design principle for something lots of people were going to use, I’d rather keep the hole with a label on it than do something I know is wrong.
More study was needed. It happened, and I think some very beautiful results came out. It’s somewhat tragic the incredible popularity of Java made it much more difficult to prove it. As soon as you get a community around something, you have to have conversations with people about how to do this, how to do that. If you do the wrong thing, people get very upset. Once upon a time it was just me, and if I wanted to make a major change to the language, it’d take 10 minutes.
Now, you have to prototype, talk to people, etc. When you’ve got literally billions of lines of code out there, and billions of active professionals using it, you’ve got to be very, very careful.
If you could go back and change anything in Java 1.0, what would it be?
I think I would have skipped AWT and gone straight to Swing. There are a bunch of things where there are still open issues, like spreading.
[There are other things too, like] little bits in that where I tried too hard to be compatible with C++. Some things like operator overloading. It’s really funny how divided the world is on operator overloading. There are lots of people who think it’s a great thing, and others who think it’s the product of the devil, and there’s kind of nothing in between. The number of people who hate operator overloading is huge. Most [are] people who are have been a victim of operator overloading in other languages that used it inappropriately. They look at C++ and the way left-shift and right-shift operators got used for input and output, and some people find that deeply offensive. I find it merely stupid.
Did you expect Java to become so popular so quickly?
Not a chance. At the time at Sun, we had this process of writing your goals for the upcoming year, and I wrote my goal for 1995 as “getting 10,000 people to download Java and try it.”
Eric Schmidt, who was technically my manager at the time, thought I was being way too optimistic, but signed off on it anyway. I kind of blew through that pretty fast. My expectations were pretty low.
The sizes of the crowds, the setup of the stages for JavaOne—you had to stand up at the Moscone Center, when they set up the stages for the largest crowd you could host at Moscone. There were a couple years where we exceeded the fire limit on the building. They had the fire department calling around, and we were specifically given a cell number for the fire department.
How did you come to do your toy show talks at JavaOne?
That was always really funny, because all the executives in this, they all wanted to do less shows. I had this take-it-or-leave-it attitude to being on stage. Everyone wanted me to do something, yet all the executives wanted to do the announcements. So I got into this motivational speech at the end. For the toy show, I’d find the coolest things I could. And you know, a lot of the cool things were the sort of public policy, Internet of Things, people doing strange things with robots.
In the late 1990s, I think most of the people in the JavaOne audience went, “That’s really cool, but completely irrelevant.” One guy, Paul Perrone, he had a company called Perrone Robotics. They just built really, really cool things. People would see these robot helicopters with laser scanning range finders on them, and people went completely crazy. But today, you can buy those at the toy store.
Did you ever show off any devices that didn’t succeed? Any failures you wish had won?
One of the directions I really liked that tragically didn’t go very far was the pen. You could write applications for the pen. You could write notes, draw a diagram, and you would get a digital capture of the trajectory of the pen. It had a little cameras embedded in it, and it could read the surface you were drawing on. It was a really beautiful device, and had a really nice way to write applications and download them to it. I think if they were to resurrect that, it could take off now.
What makes Java so magical?
The fact that it still lets people build cool things with it. Java is not magical in and of itself; it’s a tool for people to build stuff. It’s the hammer and the nail. One of the things that turns out to be easy to do is things like AI and other fairly intelligent systems.
The system I work on for my day job here [at Liquid Robotics], I build these oceangoing robots. That in and of itself is pretty weirdly cool. One of the features this robot has that makes most people’s brains melt is that if a ship tries to collide with it, it gets out of the way. It has automatic collision avoidance and it works. We still get ship captains who get all panicky about being in and among these robots, but these robots just get out of the way.
You have to have a special command for these things so you can’t pick it up, because it gets out of the way. We get complaints from people saying we can’t pick up the robots. We have a special command: “Don’t be afraid of this ship.” Building that kind of behavior is pretty straightforward in Java. It’s something I wouldn’t want to do in C.