Loading…

The good ol’ days of building Java

Ryan sits down with Tim Lindholm, an early contributor to the Java language at Sun Microsystems, to chat about what it was like building one of the most popular programming languages ever at its inception, why it was strategically important for the Java team to create a cross-platform ABI to compete with Windows NT, and how applets were initially just an interesting demo.

The Stack Overflow Podcast cover art

Watch the new documentary by Cult.Repo on YouTube to learn more about the early history of Java and the people who built it.

Connect with Tim Lindholm on LinkedIn.

Shoutout to user gabuzo for winning a Populist badge for answering What is the standard method for generating a nonce in Python?.

TRANSCRIPT

[intro music]

Ryan Donovan: Hello, everyone, and welcome to the Stack Overflow podcast, a place to talk all things software and technology. I'm your host, Ryan Donovan, and today we're talking about the good old days of Java, what it was like building the language at its inception. And my guest for that is an early contributor to the Java language, Tim Lindholm. So welcome to the show, Tim.

Tim Lindholm: Hi, glad to be here.

RD: So usually at the beginning of the show, we ask people how they got into software and technology. But since you're retired now, maybe a sort of proceeds of what your software and technology life was.

TL: Yeah, I offended people by saying I never wanted to be a computer person because computers are for people who can't do real math. I was going to do real math.

RD: Oh, you're one of those people.

TL: Yeah, I was a total jackass. But yeah, so I was living in a tent in the woods outside of a small town in Minnesota. Outside of my college, I went to waiting to get into the Berkeley PhD program in math. And as winter came on, they rejected me. I had no plan B and had no money. In a matter of desperation, I got an internship at Argonne National Laboratory. And at this point, I basically didn't know how to program at all. Theoretically, I was going to help them work on their big theorem provers. But by the time I got there, I'd utterly failed to teach myself Pascal. So I was really kind of screwed. But these guys had figured out that there's this prologue language. Logic programming was just starting to be a thing. And they had these massive theorem provers that were super powerful, but they were also very slow. And it was very difficult to treat them like a programming language, which is my original job there, programming first-order predicate calculus. They also had this crazy machine called the Denelcor-HEP that I never actually even saw, but it's, still is, one of these basement filling machines. There was a super pipeline thing and this was, this was in about 1983 and so, so my first real program was writing a virtual machine for the prologue language to run on a Denelcor-HEP, and I learned C for this, and this was the most wonderful thing in the world. I just freaking loved it. We had to go between the various virtual machines and decide which ones were the best. We picked one which was just beautiful. I love it. I love it better than Java machine by a long shot. I started programming by working on virtual machines. I stayed as an intern for a year and a half, getting paid 800 bucks a quarter. And eventually they had to kick me out because I didn't care. It was so much fun. But they eventually had to kick me out because they couldn't actually hire me if I didn't have a PhD. So I followed the prologue people to the University of Edinburgh and promptly discovered that all my heroes that had been at Edinburgh had come over to California to do a startup. It was the fear of the Japanese fifth generation project in about 1985 that led to this. Pretty soon, I was poached very, very willingly from the University of Edinburgh's AI department to this little startup called Quintus in Palo Alto. That's how I came. I grew up in Minnesota, but I came to California from Scotland. And this was a startup called Quintus, and they did commercial logic programming systems. And I was one of the main people working on the runtime system and the virtual machine there. I did that for quite some years. And then they eventually decided there wasn't money in the language systems and started to do applications. So I left because that wasn't exciting.

RD: Right.

TL: After a brief hiatus at Xerox PARC, which I just didn't click with, I wanted to get out of there. And I heard about this little group doing some sort of crazy language stuff. And the really cool thing was I could walk to work if I joined that group. It was just down the street for me. And it had these people, it had this godling guy who'd done something with Emacs. And I, you know, went over and talked to them and they seemed like a lot of fun. So I joined that, and that was the Oak team. That was the iteration of Java called First Person. I mean, you'll hear from James about the Green Project. The First Person was sort of a startup within Sun intended to commercialize the work of the Green Project, and that's what I joined.

RD: Yeah. It's really interesting that you sort of basically spent your whole career doing languages up to the Java point, right?

TL: Yeah.

RD: So when you got your hands on Java, what sort of state was it in?

TL: This is quite interesting. I was hired, my friend Frank Yellen was hired at the same time because we both knew how to do advanced language runtime systems. He came from Lucid and Common Lisp and I came from Quintus and Prologue. And we both were hired at the same time, specifically because the First Person team needed some people who knew how to do runtimes, multi-threaded stuff or garbage-collected stuff or high-performance virtual machine bytecode interpreters. That kind of business, which was the coin of the realm at this point. Now, this is a long way of saying that the actual– what we inherited at that point was kind of a mess. There is this classic sequence of what are the values of Java and object-oriented, multi-threaded, all these sorts of things. In principle, all those things were present in the early Oak language, but they didn't work with a damn in a lot of cases. The runtime was wildly thread unsafe. And the thread system didn't actually work. It couldn't work. It was fundamentally flawed. It used a conservative garbage collector, which meant it kind of did wacky things at times. A conservative garbage collector would also scan, say, the C stack, looking for things that look like pointers. But an integer that looked like a pointer, it would go and mark and preserve whatever that integer seemed to point to. So yeah, so you really didn't know what was going on. So Frank and I, we started making this stuff actually work. That was our initial goal. I started working on the garbage collector. But a key thing in the history of all this is about a month, like within the first month of me joining, the whole purpose for First Person fell apart. There was a system to be built for Time Warner doing set-top boxes for Orlando, Florida.

RD: Okay.

TL: And this contract was the be all and end all for First Person at that point.

RD: Right.

TL: And everyone was focusing on taking the green technology and putting it into set-top boxes. And at the last minute, at the last minute, Silicon Graphics was given the contract. And it was like one of these things that by the end of the day, First Person was dead. So at that point, not a lot had really happened. But it was out of the wreckage of that that this fraction of the First Person team decided to move this Oak stuff to this World Wide Web thing which is brand new. There's one person who was fiddling around with this Mosaic browser thing. And he said, we ought to try and do something with Oak in this Mosaic thing. And so a really powerful time happened from about... July of ‘94 till December of ‘94 where we we did things like, I mean work on– work on the reliability, work on making the garbage collection work and all this, but

also build libraries, build graphics libraries. A lot of the class libraries, the really early class libraries were done in the sixth month. And then, you know, invent applets and do a browser where you can see animations done through applets in a browser, you know, and make this stuff all work, work well enough to be, to be demonstrated, you know, in some like fundamental multi-threaded way. Like you'd have, you know, Duke dancing around, multiple Dukes dancing around on the browser, you could be wanging on the floor bar. The Duke would keep dancing, even though everything was going up and down. We did this in like six months. And so that was a really foundational thing about defining what the first generation would be. Because at that point, it really wasn't clear what would, okay, suppose we were going to do Java or Oak in browser. What would that even mean? And there were other considerations like that Oak might be used as an alternative to, what are they called? Some of the multimedia authoring.

RD: Oh yeah, like Flash or something or whatever.

TL: Yeah, yeah, yeah, that sort of thing. And so the notion of what Java would be something that would run in browsers on the internet came from that time. It kind of was the way we settled things down and the direction we decided to go. This has been kind of a long rant.

RD: I love it. It's interesting because, you know, I remember those early days of the internet where it was a very spare time except for Java applets embedded, Flash stuff embedded. It's interesting that, you know, that was a sort of like initial use case of Java.

TL: Yes.

RD: Was that the intent, do you think?

TL: Yeah, I think that's a super important question to have answered. It was not the intent. The principles behind Java, the sort of like the right ones run anywhere or the cross-platform or the class libraries and all this sort of stuff, it had a bunch of properties that we thought were strategically very, very important, especially very important for Sun at that point because Sun was facing an existential crisis over Windows NT. And what we were explicitly trying to do at that point was to create a new interface to program to that was a binary interface, not an OS and a CPU, but provided an ABI, an application binary interface that was cross-platform. So even if Sun couldn't compete today, at least Microsoft wouldn't wrap up control of the whole computing world for the next generation. And this was because Windows NT was actually good. The previous things were not good, but NT was real.

RD: I mean, it was the thing that programmers programmed on for the longest time, right?

TL: Yeah. We explicitly had a notion that the important thing was the ABI. People would talk about it as the JVM. It's not really a JVM. It's like the JVM and the runtime system. And the Java language was one language that could be implemented using the Java runtime system. Applets were one way that we could make the Java functionality and the cross-platform ability visible to people. Applets were just an interesting demo. Now, you can't say, oh yeah, this is this little thing we're having fun with. You need to take it seriously. Then kind of likewise, the Java programming language wasn't the be-all end-all. It was a language that we would try to make good and make very usable. But strategically, the ABI underlying it all was the most important thing.

RD: Yeah. I remember my first encounter with Java was in a Fundamentals of CS course in like ‘96 at Carnegie Mellon, which I think was like Java 1 pilot or something. And I'd done an intro class in C, and I remember being like, oh, there's so many things that are similar, but a lot that's different, right? It runs on the VM. You call threads explicitly. It had the Java Windows Toolkit, whatever it was. And I was like, oh, that's so much easier.

TL: AWT, yeah.

RD: And it seemed like a much more user-friendly language to start with. How much was that by design?

TL: All of it was by design. In the Java documentary, James gives what I thought was one of the best concise statements of how this was being thought about that I've heard. The goal was very much to sneak in advanced concepts that were obscure or kind of edge concepts like garbage collection and threading. They existed out there, and certain classes of people used it, use it all the time, but it was not normal programming environment functionality. Trying to do some simpler object-oriented stuff compared to C++, but to make it all look, make it all feel comfortable, like it kind of looked like C and C++, and you kind of knew what was going on for the most part. I think that's a really deep lesson to learn throughout computing. That was something I used throughout my time at Google, that if you try and shift people off something they're comfortable with, you have a very hard time. But yeah, I think that James, even before I joined, I think James largely had his litany of principles that he wanted the system to demonstrate.

RD: I would talk about the garbage collection a little bit because you said it wasn't something that people did much. And I remember it being a new thing. Like, oh, I don't have to deallocate pointers or anything. But you also mentioned that it was doing some weird stuff like treating integers as pointers and messing around there. What does it take to build garbage collection into a programming language?

TL: It depends a lot what your programming language is. There was a guy when I was at Xerox, there was a guy at Park who is working explicitly on doing garbage collection in the C family of languages. That's something hard to wrap your head around. The good thing about Java is everything is linked. All the objects have pointers to them, and you can identify all the routes that you need to traverse in order to find all the objects. You sort of co-designed the language in the runtime so that you could do that. The thing was that at the time, in the original Oak implementation, I think the guys who had done it, it was a very, very small team, and they did remarkable stuff. But I don't think they really understood garbage collection very well. That's kind of why they hired Frank and I, because we did. They hadn't built the virtual machine such that you could know what the roots of all the objects are. So they had to just look at everything and say, well, if it looks like an object, we'll treat it like an object. It was specifically called a conservative garbage collection. It made trace and mark things that weren't actually objects at all.

RD: Well, isn't everything supposed to be an object in Java?

TL: It is, but this implementation just wasn't such that it… I mean, the original garbage collector hadn't been written in such a way that it treated things like that. It was more like a garbage collector for C than for Java. And that's no longer true. I mean, the garbage collectors just are superbly sophisticated. I mean, the original one, it was a stop and– stop everything and spend 15 seconds garbage collecting and hoping nobody notices. I mean, it was really, really pretty crude. That first version you looked at was still running that garbage collector. We ran that crappy garbage collector for a couple of years, I think. These days, the things that people have done are so sophisticated.

RD: Well, they've had 20 years to learn the lessons and how Java started, right?

TL: Actually, that's one thing I never really thought of. It was kind of obvious. I used to say that Java is a... a guaranteed employment project for lots of people who want to do things like garbage collectors. In fact, it also engendered just a huge amount of activity in making garbage collectors or virtual machine, I mean, threading systems and multiprocessor parallelization packages. It really was, it was kind of the platform in which a lot of research was done and then saw the light of day.

RD: For the virtual machines, I remember that being hugely impressive when I first saw it. And then my first job out of college, we had a Java installer. And it ended up that every version of that installer had to be sort of tightly fiddled with for each of the versions of the virtual machine. How hard was it to get that to be a universal experience?

TL: Yeah, it was terrifically difficult. Very often, if you look at some of the big projects that get done in the industry, you can say to yourself that the people who did it wouldn't have done it if they realized how hard it was going to be. But you're sort of young and optimistic and think, you know, how hard can it be? But one thing, the whole right once run anywhere thing, people like to bitch about that and throw darts at it because it was never perfect. And what we're trying to do is create an ABI that not just across platforms and operating systems, but across releases where things would keep working. And so we built huge, huge compatibility test suites to double check that things work the same way on different platforms. And we would literally, we would find bugs, bugs in behavior, and we'd go to the spec because everything was driven by the spec. We were trying to be... yeah, the specs were supposed to be the thing that really defined how things work. And you go to the spec and you say, well, you know, there's this bug. I don't think it should work like this. And the spec doesn't say. And so what we would literally do is write the bug into the spec because we had millions of people using these systems. And we didn't know who was relying on the bug and we couldn't afford to break that. It was terrifically difficult to do all this, especially when you think about that, you know, we're starting off, we had like 12 or maybe, well, you know, like 12 people doing it. Right. It was really hard.

RD: Yeah. And I imagine, you know, with the sort of, you know, even today, the difficulty with different hardware on the same operating system, right? You have the x86 and the ARM where you have to recompile for each. Was it always possible to compile to like a JAR and have that JAR run everywhere?

TL: It's one of these sort of 99%-- I don't know what the percent actually is. But in principle, the JAR file should run everywhere. And beneath the JAR, you'd have the class loader and you'd have the virtual machine implementation and the library implementations. And there was a layer in those things that was basically like the... the interface between the platform independent and the platform dependent stuff. So if you're going to get the Java runtime running on an HP, you needed to do a port. Or a PowerPC, you needed to do a port, make it all work. Or if you're going to run it on Windows NT. And in some cases, the operating system or the hardware wouldn't naturally provide the same distractions. There was an interesting fire drill around Intel x86 floating point numbers, where the floating point built into the Intel chips is really kind of weird. It didn't follow the industry standards. And yet Java had defined floating point to be identical down to the bit to implement the original spec, this was a long time ago. I might get this wrong. Hope not. Because this was like my problem. My personal problem for a while. But I think you basically would have had to write an interpreter for correct floating point behavior, following the industry standard spec. That would make floating point run like a pig on Intel hardware. So there is a big stressful time.

RD: It would have to get translated every time, right?

TL: Yeah. And you'd probably have to be interpreted. You'd be running an interpreter to do your

floating point arithmetic, and that would be awful. There was at one point a really big blow up. This is like a corporate level blow up between Sun and Intel, where Intel says, we're going to do

horrible things if you don't change Java so that it runs fast on Intel. I and another guy got tasked with figuring out how to do this. This is where there's a hack that was defined into the language where it's called default floating point and strict floating point. And I think default floating point loosened the spec such that Intel was legit. And for the most part, that was good, good enough for people. If you really wanted to write once for anywhere, you'd have to use strict floating point. And then that might run like a pig on Intel.

RD: Wow. The sort of backwards compatibility thing is a, it's a huge deal because, you know, the x86 spec has that too, right?

TL: Yeah.

RD: You know, over time you're just burdened by like all these extensions.

TL: Well, we're trying to avoid DLL hell, right? But then I'm not saying we achieved this because you ended up like, you said a new version would come out, you need to get– need to install a new JRE. Well maybe you're– maybe the app you depended on didn't work on the new JRE for some reason, and, and so you didn't keep the old JRE around. Or, you know, it was, it was just bad. But then, but the alternative was not perfection is the thing, the alternative was DLL hell and insecurity and all this.

RD: Yeah, I mean the, the existing sort of workarounds to that weren't great and they weren't, you know, cross compatible.

TL: Right, yeah yeah.

RD: You know that's, that's sort of early days but you were, you were at Sun working on this for 11 years, right?

TL: That's right.

RD: From the sort of start of that to the end, what do you feel like was the greatest effect you had on the language?

TL: I didn't have much effect on the programming language. And here's where I separate the runtime and all that. I mean, I was responsible for a long time for the garbage collection, for the threads. Frank Yellen and I share responsibility for the virtual machine implementation, trying to make that fast. You know, I had some clunkers, like I was responsible for finalization, which everybody loves to hate. That was just a weekend hack because somebody wanted something that did that. And the trouble is it got out of the box. And now it's one of the most hated parts of the system. But I think what happened was that I eventually started to, I wasn't a great programmer. I wasn't a great language person at the level of what was needed. Within not too many years, we bought a company, a little company, a startup, done by half a dozen people who had been trying to work on some very advanced virtual machine implementation techniques basically for small talk and then for the self-language was kind of a researchy academic language. And they were the people who developed the hotspot technology, which is what I think, I mean, I don't know if it's correct. I've been out of the loop. I don't know if it's correct to say that what's currently being deployed is still based on hotspot. But it was a huge leap in terms of the sophistication of the implementation. It was basically doing just-in-time compilation on the fly. It was very, very efficient and quite clever. Now, of course, stuff has gotten much, much, much more clever since then. It's astounding how much better things have gotten. But this was a big leap beyond the things Frank and I were able to do among all the other things we had to do at the time.

RD: Yeah. Well, I mean, I imagine it was probably a pretty good foundation that you all built.

Like the JVM now hosts other languages, Kotlin. I think Scala, Scala JVM language?

TL: I think maybe.

RD: What about Clojure?

TL: Oh, Clojure, maybe, yeah. Again, I'm out of... apologies if I get stuff wrong. I've not been in there. Basically, I've been doing garbage collectors for data centers for 20 years now. My whole career, 40 years of garbage collectors.

RD: So, you know, you talked about the advancement of garbage collectors. What is garbage collection for a data center?

TL: Well, this is Google stuff. I basically did resource management at Google. And there I designed a system. I and one other guy designed a system that would make getting the resources you need in order to run, you know, like a Google job might spread a binary to 500 machines and run them all and they all communicate and all this sort of thing. So you needed flexible ways for people to be able to allocate resources. And I and this other guy designed a system that would be much easier than what people had been doing before. And over time, it became just complete second nature and took over all of the resource management at Google. So everything is done using the system, which is kind of cool. And we even expanded it across data centers. So one system that you can treat multiple data centers as basically approximately one computer.

RD: Oh, cool. Yeah. Maybe that makes you the world's greatest digital garbage man, yeah?

TL: Well, nobody else probably wants that title.

RD: Was there anything that you wanted to talk about or mention before I head to the outro?

TL: The one thing I think is important to recognize is what matters and why. And we kind of made the point that the Java runtime environment, of which the JVM is a part, is really the thing that it may be– it's infrastructure. It's not the thing you always see, but in a sense, it's most important. And things like Kotlin running on that was always part of the thought. That that is working shows that we got the... the abstractions underneath, at least close enough. I'm not saying, I mean, one key thing you have to understand about Java is that it took off so fast that we never had a chance to go back and clean up the things that we really wanted to clean up. We were getting, you know, I mean, doubling every three days or whatever. It was just crazy. So, you know, Java is, it had a lot of good principles. The implementations were good enough. And good enough that people would put up with the ways in which they were not very good, but grant us the right to turn the crank one more time and hopefully fix things. And if you look at what's happened, it's been 30 years of people making Java better and better and better and better. Yeah. Yeah. And I've talked to George Saab, who's in charge of the project now. They keep adding in new features, keep building interesting stuff. It's really cool to see.

[music]

Well, it is that time of the show again, where we shout out somebody who came on to Stack Overflow, dropped some knowledge, shared some curiosity, and earned themselves a badge. Today, we're shouting out the winner of a Populous badge. Somebody came on to Stack Overflow, dropped an answer that was so good, it outscored the accepted answer. So congrats to Gabuzo for answering, what is the standard method for generating a nonce Python? If you're curious about that. We'll have the answer for you in the show notes. I'm Ryan Donovan. I host the podcast, edit the blog here at Stack Overflow. If you have questions, concerns, comments, et cetera, please email me at podcast@stackoverflow.com. And if you want to connect with me directly, you can find me on LinkedIn.

TL: Thanks, Ryan, for hosting me. This is kind of fun. I really appreciate talking about the

old history of this stuff. And for any of you listening who haven't heard about it already: there's a new documentary done by the Cult Repo Guys. You can find it on YouTube. It's really easy to find. The quality is just superb. They've done a great job. It's covering such a wide stretch of history that it doesn't cover everything. You can't cover everything in an hour and 15 minutes, but what they do is really worth watching if you care at all about this stuff.

RD: Well, thank you for listening, everyone, and we'll talk to you next time.

[outro music]

Add to the discussion

Login with your stackoverflow.com account to take part in the discussion.