September 29, 2020 | programming | No Comments
James Gosling, the father of Java, one of the world’s most widely used programming languages, has talked with research scientist Lex Fridman about Java’s origins and his motivations for creating a language that would be used on tens of billions of devices and become central to the development of Android at Google.
Gosling designed Java 25 years ago while at Sun Microsystems. In 2009, Java would be one of the key reasons Oracle acquired Sun. According to Oracle, today there are 51 billion active Java Virtual Machines (JVMs) deployed globally.
But long before Oracle’s acquisition of Sun, Gosling said he and a team at Sun “kind of worried that there was stuff going on in the universe of computing that the computing industry was missing out on” – what would become today’s Internet of Things.
“It was all about what was happening in terms of computing hardware, processors and networking that was outside the computing industry,” he said.
“That was everything from the early glimmers of cell phones that were happening then to – you look at elevators and locomotives and process-control systems in factories and all kinds of audio and video equipment.
“They all had processors in them they were all doing stuff with them and it felt like there was something going on there that we needed to understand.”
At that stage C and C++ “absolutely owned the universe” and everything was being written in those languages.
Gosling says his team went on several “epic road trips” around 1990 to visit Toshiba, Sharp, Mitsubishi and Sony in Japan, Samsung and several other South Korean companies, and went “all over Europe” to visit the likes of Philips, Siemens and Thomson.
“One of the things that leapt out was that they were doing all the usual computer things that people had been doing 20 years before,” he recalls.
“They were reinventing computer networking and they were making all the mistakes that people in the computer industry had made.
“Since I’ve done a lot of work in the networking area, we’d go and visit company X that would describe this networking thing they were doing, and just without anything, I could tell them like 25 things that were going to be complete disasters.”
Discovering that industry outside the traditional computing world was now repeating earlier mistakes was one of the key reasons Gosling and his colleagues thought they could offer something useful in Java.
However, he also realized the consumer electronics industry and the computer industry had a very different view of customers, which helped inform how he would design Java.
“High on the list was that [consumer electronics companies] viewed their relationship with the customer as sacred. They were never ever willing to make trade-offs for safety. One of the things that always made me nervous in the computer industry was that people were willing to make trade-offs in reliability to get performance,” said Gosling.
“Just figuring out … how to make sure that if you put a piece of toast in the toaster, it’s not going to kill the customer. It’s not going to burst into flames and burn the house down,” he added.
After those road trips, Gosling and the company built a prototype control system in C and C++ code for home electronics goods, such as a TV and VCR. Security was a key consideration in his objectives for what would become Java.
“Back in the early 1990s it was well understood that the number one source of security vulnerabilities was just pointers, was just bugs, like 50% to 60% to 70% were bugs and the vast majority of them were like buffer overflows. We have to make sure this cannot happen. And that was the original thing for me was ‘This cannot continue’.”
But earlier this year, Gosling read a news report about the Chromium team finding that 70% of security bugs in the Chrome code base were memory management and safety bugs.
“Chrome is a like a giant piece of C++ code. And 60% to 70% of all the security vulnerabilities were stupid pointer tricks. And I thought it’s 30 years later and we’re still there,” said Gosling.
Beyond safety and security considerations for Java, he wanted to ensure “developer velocity”.
“I got really religious about that because I’d spent an ungodly amount of time of my life hunting down mystery pointer bugs. The mystery pointer bugs tend to be the hardest to find because … the ones that hurt are a one in a million chance,” he notes.
“When you’re doing a billion operations a second, it means it’s going to happen. I got religious about if something fails it happens immediately and visibly. One of the things that was a real attraction of Java to lots of development shops was that we know we get our code up and running twice as fast.”
Object-oriented programming was also an important concept for Java, according to Gosling.
“One of the things you get out of object-oriented programming is a strict methodology about what are the interfaces between things and being really clear about how parts relate to each other.”
This helps address situations when a developer tries to “sneak around the side” and breaks code for another user.
He admits he upset some people by preventing developers from using backdoors. It was a “social engineering” thing, but says people discovered that restriction made a difference when building large, complex pieces of software with lots of contributors across multiple organizations. It gave these teams clarity about how that stuff gets structured and “saves your life”.
He offered a brief criticism of former Android boss Andy Rubin’s handling of Java in the development of Android. Gosling in 2011 had a brief stint at Google following Oracle’s acquisition of Sun. Oracle’s lawsuit against Google over its use of Java APIs is still not fully settled after a decade of court hearings.
“I’m happy that [Google] did it,” Gosling said, referring to its use of Java in Android. “Java had been running on cell phones for quite a few years and it worked really, really well. There were things about how they did it, in particular various ways that they kind of violated all kinds of contracts.”
“They guy who led it, Andy Rubin, he crossed a lot of lines. Lines were crossed that have since mushroomed into giant court cases. [Google] didn’t need to do that and in fact it would have been so much cheaper for them not to cross lines,” he added.
“I came to believe it didn’t matter what Android did, it was going to blow up. I started to think of [Rubin] as like a manufacturer of bombs.”