Command Line Heroes - Creating JavaScript
Episode Date: July 23, 2019A mission to set the course of the world wide web in its early days. 10 days to get it done. The result? An indispensable language that changed everything. JavaScript was the underdog that won against... all odds. Clive Thompson recounts the browser wars and how much the fallout influenced the future of the internet. Charles Severance explains how JavaScript went from a last-minute moonshot to the default web development language. Michael Clayton confesses he, like many others, underestimated JavaScript. And Klint Finley describes a gloomy internet without it. If you want to dive deeper into the story of JavaScript, head on over to redhat.com/commandlineheroes We first mentioned JavaScript's story in Episode 2 of Season 2—and made a slight correction to the story in this episode. To learn even more about those 10 days, check out the DevChat podcast interview with Brendan.
Transcript
Discussion (0)
Brendan Eich was 34 years old when he sat down at his desk in the Netscape headquarters.
He was committing himself to a massive 10-day sprint of coding.
A new language, a whole new programming language in just 10 days.
It was 1995 and the world of programming languages was about to change forever.
I'm Suranya Dbarik, and this is Command Line Heroes, an original podcast from Red Hat.
All season long, we're exploring the power and promise of programming languages,
discovering how our languages shape the world of development
and how they supercharge our work.
This time, we're tracking the creation of JavaScript.
Maybe you've heard the story of Brendan Eich before, but how does something like JavaScript
really get created?
There was Brendan's sprint, sure, but there's so much more to the story.
Our JavaScript tale begins in the midst of a war.
A browser war.
The browser wars of the 1990s may seem like history, but they were hugely consequential.
On one side of the battlefield, Netscape, which had formed an alliance with Sun Microsystems. On the other, you've got Microsoft, software behemoth.
And what were the spoils they were fighting over?
It was a battle to decide who would be the gatekeeper of the internet.
The stakes could not be larger.
To really understand how the browser wars went down,
I called up one of my favorite tech historians, author Clive Thompson.
His most recent book?
Coders, the making of a new tribe and the remaking of the world.
Clive and I got talking about the browser wars.
But let me really set the scene for you. You've got Netscape realizing that the browser was this key piece of software that people were going to use to get online.
And then you've got Microsoft.
Their whole business model was packaging stuff inside Windows.
They hadn't really been interested in browsers. Until, in the 1990s, Microsoft realized that maybe they'd been sleeping at the wheel.
The world was moving online, and there was nothing inside of Microsoft Windows that would help them get there.
But these guys over here, some company called Netscape, they're offering an on-ramp to the internet. All of a sudden, Microsoft's industry-wide dominance
doesn't look so absolute.
The browser wars begin in that moment,
the moment when Microsoft wakes up
to the power of the internet
and squints its eye at their new competition.
So that's my setup.
Here's me and Clive hashing out what happened next.
The fight was over who was going to be the main portal to going online.
You have to realize that in the early 90s, no one was really online very much.
And when Mosaic came along and eventually turned into Netscape,
they were the first browser that anyone could download that let you look at the web.
And they went online in December of 1994. And so suddenly, you know, thousands and millions of
people are able to use the internet in this kind of graphical way. They're just getting massive,
massive downloads and huge amounts of press. And everyone's basically saying, yeah, Netscape is
kind of the future of this thing called the internet. So over in Seattle, you've got Microsoft watching this with enormous alarm
because they had pretty much ignored the internet.
They were focused on selling Windows,
and they had really not paid any attention to this crazy newfangled thing called the internet.
So they had to play a very rapid game of catch-up.
They did not get their own browser out for almost a year later.
In the fall of 1995, their browser came out.
And that was essentially the beginning of the browser wars,
the moment when Microsoft was trying to fight
to be the portal by which people went online.
Okay, so a year to me doesn't sound like,
that doesn't sound like too bad, right?
It's not too wrong, right?
That seems like a reasonable amount of time.
No, it's true. It doesn't sound like a long time, but things were moving so rapidly back then. And
there was a strong sense of first mover advantage that the first company that could sort of brand
themselves as the way you get online would be the winner for years and years and maybe forever.
Because I remember how rapid the pace of development was. I mean, Netscape was putting
out a new browser every couple of months, right? Like they would be, wow, now we've got email
integrated into the browser. And now we've got, you know, a sort of a little search bar up top.
It just kept on becoming better and better. You could sort of see, you know, all the things you
could do online swimming into view as they rapidly iterate and rapidly push things out.
Microsoft is accustomed to developing very slowly.
Here's your four-year-long development process.
At the end, it's as bug-free as we can get it,
put it in a box, goes out to the stores,
and we don't release a new version for four years.
Netscape comes along and is the first company to say,
no, we're going to put out kind of a substandard product,
but it works well enough,
and we're going to have a new one for you to download in three months and three months and three months.
And this completely destabilized Microsoft.
Okay, so if I'm Microsoft, I can look at it and go,
oh my goodness, this is the future.
I need to catch up.
I need to compete.
Or I can say, ah, it's a fad.
So what is it about the browser that made Microsoft pick the first option that made Microsoft go, oh my goodness, this is a real thing.
I need to compete.
The thing about the browser was that it had a huge amount of cultural cachet.
It was the first thing you could do on the internet that was like culturally fun. You know, you could go to
suddenly a band's webpage and see posts by them and photos by them. You could go and research,
you know, your hobby by finding all the model train people in Florida, right? So, you know,
everything about the internet before that had seemed nerdy. Email, you know, file transfers,
whatnot. I mean, suddenly the browser made the internet look like
a magazine, like a fun thing to interact with. And so newspapers and CNN and magazines were sort
of writing about it in this very excited way for the first time. This was the moment that technology
moved from being buried deep inside the business section to being on page A1 of the New York Times.
So what was appealing about Netscape or even just the browser in general when it comes to developers? Why were they so into it?
I've met a lot of developers. Suddenly the internet comes along with the browser
and you can just have a web page that says, you know, just download my cool piece of software.
So it unlocked the entire world of the way that we see software being made today.
I should mention here that at first, Microsoft actually offered to buy Netscape,
though they were offering a pretty tiny amount. But Netscape turned them down,
so Microsoft had to build a browser of their own. They called theirs Explorer. Microsoft spent a year frantically working on a browser
and they got it out in the fall of 1995. And they did sort of the same thing that Netscape did.
They produced something quickly without worrying if it was perfect and it got better and better.
But what really emerged over the latter half of the 90s
was a war over, you know, whose browser would be the most interesting, the most, you know, sort of
interactive and sophisticated. Keep in mind that Netscape by no means had the upper hand here.
Microsoft just had a very powerful position. You know, when you ship Windows to, you know,
on the order of 80 to 90% of all computers on the planet,
it's pretty easy to make your software the default,
and that's exactly what they did.
And so you see, you know,
Explorer sort of rise and rise and rise.
In a way, poor old Netscape
was always the underdog in that battle.
But here's the thing.
Before the battle was over, they threw a beautiful Hail Mary.
And it turns out, that would become an incredible score for the whole world of programming.
That is the fascinating and weird story of the creation of JavaScript.
All that heat around the web, around the potential of life in a browser,
had made one thing very clear.
We needed a new programming language, something that went far beyond HTML.
We needed a language tailor-made for all that new web-based development.
We wanted a language that didn't just survive online, but thrive there.
How do you create a programming language for the browser?
That, my friend, was the billion-dollar question.
So, around the time Netscape saw that Microsoft was competing with them,
they took a look at Java.
Was Java going to be the language for web development?
Java was this rich, compiled language.
It performed just as well as C++. but it did still need to be compiled.
Developers really wanted something more lightweight, something that could be interpreted instead of compiled.
Something that would appeal to all those non-professional programmers that were swarming to the web.
Those new programmers wanted to work directly on the web page, after all.
That was the dream.
Netscape needed a programming language that would run inside their browser.
Something that would allow developers to bring those static web pages to life.
Wouldn't it be great, they thought, if they could release a new lightweight language that worked wonders
for web programming at the same time that they released Netscape 2.0 in beta? There
was only one hitch that gave them exactly 10 days to create a new language.
Actually, it gave one guy, Brendan Eich, 10 days. He was the one tasked with pulling this off.
There was no doubt that if anybody could do it, this guy could.
When Brendan was a student at the University of Illinois,
he used to create new languages for fun, just to play around with syntax.
The key to Brendan Eich is that Brendan Eich, when he built JavaScript,
had become sort of a language junkie.
To understand what Eich actually pulled off, we reached out to Charles Severance, a professor at the University of Michigan School of Information.
JavaScript was sort of created in an environment where Java was seen as the future. And so in 1994, we thought that it was the thing that was going to solve everything. One year later, the thing that would actually
solve everything was about to appear, but it couldn't say, hey, I've solved everything because
everybody, myself included, believed in 94, 95, that we had seen the future of rock and roll.
And it was the Java programming language.
They had to build a language that seemed irrelevant, seemed silly, seemed meaningless, and yet was the right solution.
What Ike delivered was not just a toy language, though. It was sophisticated in hidden ways, drawing on major inspirations from languages that had come before.
If you look at the basic syntax, it's very clear that it's inspired by the C language with its curly braces and semicolons.
Some of the string patterns were taken from the Java programming language. But the object-oriented underlying pattern was taken from a programming language called
Modula 2, which had this notion of first-class functions, which to me is really one of the
most amazing choices that made JavaScript such a powerful and extensible language.
And that is that the function, the body of the function, the code that makes up a function
itself is also data.
And the other thing that really was a part of the inspiration was HyperCard.
JavaScript was always running in a browser, which meant it had a basic data context of the document object model, which is an object-oriented representation of a web page.
It is not like a traditional programming language.
The JavaScript code didn't start at the beginning. The first thing that it was was a web page. It is not like a traditional programming language. The JavaScript code didn't start at the beginning. The first thing that it was was a web page. And so it ended
up with this event-oriented programming. When JavaScript was released along with
Netscape Navigator 2.0 on November 30th, 1995, all that magic was housed into a powerful little seed of
a language. 28 companies, including America Online and AT&T, agreed to use it as an open standard
language. When it was released, there were some old pros looking down their noses at JavaScript.
They thought it was just a language for newbies.
They missed its revolutionary potential. Brendan decided he would sneak in all these
super advanced concepts from languages that are not well known, that were very like advanced
object-oriented languages. And so JavaScript is almost like a Trojan horse. It sort of sneaked
into our collective consciousness with the idea that it was silly and fun and easy and lightweight, but then built in from almost the very beginning was a powerful, deeply thought, well thought out programming language that's capable of doing literally almost anything in computer science. The result was a language native to the browser that could evolve as our online lives
evolved. It didn't take long before JavaScript became the de facto web development option.
JavaScript was a language that I had no choice but to learn. And literally, people that learn
JavaScript usually have no choice because they're like, I want to build a browser application and I
want it to have interactive elements. And the answer is, therefore, you must learn JavaScript.
If you imagine, like, what is your favorite language?
The answer to that question is almost got to be X plus JavaScript.
Right. Someone might say, I like Python and JavaScript or I like Scala and JavaScript,
because it's like the one language everyone is required to learn.
Charles Severance is a professor at the University of Michigan School of Information.
Netscape had been incredibly strong coming out of the gate, and they fought hard during the browser war.
But in the end,
Netscape just disappears as a serious product.
Microsoft's industry-wide domination was an overwhelming force. Despite being a year late to the browser game, they were able to pull themselves back on top and win the day. But you know, Netscape's Hail Mary, its creation of
JavaScript, was a success. Because long after the fight was over, this gem of a language that came
out of their browser war, it might take for granted that you can develop interactive web pages that change and update without pulling a whole new copy of the page from the server.
But imagine for a sec what it was like when doing that became a brand new option. We asked Michael Clayton, a software engineer at
Red Hat, to help us understand what a huge shift that was. In, I want to say 2004, Google Mail was
released, Gmail. And it was, to my knowledge, the first web application that really took JavaScript to the next level,
that used it to dynamically switch content out that you were looking at.
Say you're looking at your inbox and you click on an email.
In the old days, your email viewer would load a whole new page in your browser just to show
you that email.
Then you close that email and it would reload the
whole inbox. It created a lot of latency. There was a lot of waiting when you would switch back
and forth between views and Gmail changed all that. They used JavaScript to, in the background,
fetch the content that you wanted to view and just put it in front of you without you having to wait for a brand new
page view. That saved a ton of time and energy. But really think about it. It changed more than
just the speed. It changed the very nature of our work. So web developer as a job title has gone from being a server side kind of behind the scenes role to
being just a very thin layer away from the user since they're writing code directly in the browser
that the user is viewing the web page through. It changed everything. In fact, you can pretty
much credit JavaScript with ushering in the web 2.0 revolution. Anybody with a web browser suddenly
had a development environment right in front of them. But, as I mentioned before, the old guard
didn't necessarily feel comfortable with how democratic things were getting.
That early antagonism of JavaScript, I was part of that myself.
I had the browser extensions that would prevent JavaScript from running.
I thought it was a useless toy language. And I kind of had this feeling of anger whenever I went to a webpage that had JavaScript required for some critical feature of the site.
I was like, you should build your website the right way
without JavaScript.
Soon enough, though, the beauty and the potential
inherent in Brendan Eich's 10-day language
became obvious to everyone.
And now it's conquering not just the browser,
but the server too.
With Node.js, a whole new territory
for that little language that could has opened up.
When I heard that JavaScript was going to be run on servers, I thought, why would anyone want to
do that? And at that point, I was already a JavaScript developer professionally. I wrote
a lot of JS every day, and I still didn't quite see why it belonged on servers.
And it's turned out, as many listeners will know,
Node.js is a huge force in the industry now.
And I think there's good reason for that.
One of the things that Node.js taps into that's made it so successful is the huge community of front-end JavaScript developers,
client-side developers.
They write code, they write JavaScript for the browser.
There are a lot of those developers out there. And by making the same programming language available for writing servers,
they just immediately have a huge population of people who can start contributing to servers. The tool is already
in your toolkit, and you can simply pull it out, install Node.js, and you're off to the races.
So, first in the browser, and then on servers, JavaScript was this unpretentious,
secretly elegant, sometimes buggy, language. A survivor from the browser war that
everybody underestimated. JavaScript has been kind of a Cinderella story of programming languages,
starting in that early state of being essentially whipped together in 10 days, going through a lot
of derision from the rest of the programming community and still somehow continuing to find success and growth.
And then coming to the point we're at now where JavaScript is either first or second place
in the most popular programming languages in the world.
JavaScript is essentially everywhere.
The ability to run inside of a web page meant that JavaScript was as pervasive as the web is, which is quite pervasive.
Michael Clayton is an engineer at Red Hat.
Did JavaScript eat the world?
Did it ride on the coattails of the web to a kind of language domination?
I wanted to find out where the edges of JavaScript actually are.
Hi, my name is Clint Finley. I'm a writer for Wired.com.
Clint was curious about the same thing.
And the more he looked at the way JavaScript runs today,
the more he realized it's got its fingers in every part of his online life.
JavaScript has become something that can empower entire applications
before you even have a chance to decide whether you want all of these different applications to run on your computer.
They just start running.
And some of them are involved with advertising or facilitating the tracking that advertisers use.
So there's a lot of things happening invisibly in your browser
that you might not really even know about or want to have happen.
So Clint decided to run a little experiment.
I decided to try just using the web without JavaScript for a while.
So I decided to give it a shot and spent a week with JavaScript disabled in my browser. Sounds simple enough.
But foregoing all JavaScript had some surprising effects.
Because JavaScript has become so big, so all-consuming,
the language famous for being lightweight
actually takes up a lot of space and energy now.
When Clint blocked that one language...
In general, it was just a much better web
experience in a lot of ways, in terms of pages loading quicker, pages being cleaner, the battery
life on my computer lasting longer, and just having more of a sense of control over what was
happening on my computer. Because there's not all of these just weird, invisible, random programs running in the background.
And just imagine the bliss of living without pop-up ads for the first time.
So much of it depends on JavaScript to even load.
So web pages came out a lot simpler, fewer ads, fewer distractions.
That clutter-free web experience isn't the whole picture though. Parts of the web
can't function at all if you unplug JavaScript. A lot of things just didn't work. Gmail redirected
me, I think, to a different version that's designed for old mobile phones. Facebook did
sort of the same thing where a lot of the smooth interactions weren't there.
It became more like a series of web pages.
So Netflix didn't work. YouTube didn't work.
Yeah, anything that's really heavily based on interactivity just didn't work.
But ultimately taking JavaScript away, there was good and bad.
And I had to decide that it's better to have JavaScript than to not have it at all.
Clint Finley is a staff writer for Wire.com.
Most predict that JavaScript will only continue to dominate mobile and desktop app development. The level of complexity possible for things like browser-based games,
browser-based art projects, etc., etc.,
is shooting through the roof.
And the ever-growing JavaScript community
is making the most of that potential.
It's worth taking a step back and remembering here.
In 1995, just a couple decades ago,
Brendan Eich was sitting in a room hammering out a new language.
And today, that language permeates everything we do.
It might sound a bit cliche to say that some new string of code is going to change the world, but it does happen.
A command line hero marshals all their love for languages into a 10-day sprint.
And the world's DNA is changed forever.
We can thank JavaScript for Google Docs, for YouTube, for Netflix.
But, you know, with great power comes great responsibility. And as JavaScript's influence continues to grow,
pushed along by a huge number of open source libraries,
that responsibility doesn't just lie with one person anymore.
A broader community has taken the reins.
Slashdata recently estimated the number of JavaScript developers at 9.7 million. And over at GitHub,
JavaScript has more pull requests than any other language. Power lies with the whole world of command line heroes, helping JavaScript grow as we develop our tomorrow.
Next time, command line heroes gets caught in a web of languages,
and we'll explore how Perl came to thrive in a wild new frontier.
Command Line Heroes is an original podcast from Red Hat.
By the way, a listener shared our Hello World episode from last season, where we also spoke about Brendan Eich in JavaScript.
In that one, a guest said that during those 10 days, Brendan probably didn't get much, if any, sleep.
Well, Brendan responded on Twitter to say he did indeed get sleep during that sprint.
To learn even more about what happened during those 10 days, check out the
Dev Chat podcast interview with Brendan. We'll throw a link in our show notes.
I'm Saranya Barak. Until next time, keep on coding.
Hey, I'm Jeff Ligon. I'm the Director of Engineering for Edge and Automotive at Red Hat.
When I say edge computing, the average person probably thinks smart device, smart fridge, smart watch, smart
speaker. But edge computing goes way beyond that. A fridge with a Wi-Fi connection is one thing.
A robotic vehicle that's sorting packets and using AI to plan its route through the warehouse,
that's something else entirely. At that level of complexity, you've got software in the cloud,
software in the warehouse, software in the robot.
How would you even manage an update without a common system?
This is where Red Hat's Edge solutions come in.
We simplify and streamline operations from the cloud to the farthest edge
across all kinds of devices and use cases
because everything should just work everywhere.
Find out more at redhat.com slash edge.