Why is Javascript so Popular?

One of the blog posts I was reading while researching this article contained many-a casual mention to how frustrating JavaScript can be. So why is it so popular in web development today?

Most people will say (in their own words) the following:

<p><strong>It's convenient.</strong></p>

That is to say, it's easy to use from a programmer's perpective. Contextually. Not linguistically. Per se. It's popular, which makes it easier to use, and finally, in some ways (which we'll get into later), it's fast. Everyone is lauding JavaScript for a lot of reasons. A lot of why JavaScript is as popular as it is now is because this language has been at the right place at the right time in the history of the web. Speaking of history, let's take a look at that real quick.

A breif History of JavaScript

JavaScript was born in 1995, when Netscape developed it. Remember Netscape? It all feels like a dream now...

The general gist of what happened for the next many years was that lots of different browsers started using either JavaScript, or similar languages. When standardization of the web (and web languages) started happening, JavaScript got nominated, and then used as a model for the standard. To this day, it's the most well known "dialect" of the standard language.

Next, JavaScript ended up being used (or modeled after) in Macromedia's "flash" player, which you may know from various hit browser games spanning the late 90's and early aughts.

There was also something going on that's often referred to as the "browser wars" wherein, lots of different browsers run in lots of different languages, and, remember the standardization comitte I talked about earlier? Mocrosoft and Yahoo! teamed up to oppose the plan they'd come up with (largely based on JavaScript), and slowed down the decision-making process considerably.

During all of this tumult, the open source community was working together to try to find a solution.

A Quick Explanation

At this point, it's important to understand two things about the internet: client and server. Your computer is a client. When you bring up a web page, your computer reaches out over the tubes of the internet to grab a file, which is stored remotely on a server. That's how the internet works. When you sign up to start a web page of your own, you have to do a couple things: buy the web address, and buy a place to store your files remotely that's going to have a consistent enough connection, and a fast enough computer behind it that everyone who wants to see your page at any given time can do so. I could use my laptop here as a server if I wanted to, but I might one day get too much traffic for my trusty little laptop to handle, or I might turn my computer off, and then people wouldn't be able to get to my site, and I wouldn't want to disappoint my audience. So I find a dedicated server to put my files on for sharing, after I'm done making them.

Back to the Story.

So, at this point in time, as I said above, whenever someone wants to see a webpage, they type in the web address and hit "go" or press "enter" or whatever. And if there are changes on that webpage, they have to hit the "reload" button in order to see them.

These open source guys, they're thinking: What is you didn't have to do that? We can build a way for that process to happen automatically, and it should probably be based on JavaScript. JavaScript works on the client side, and works very nicely with the other web languages already, but it's got a little bit more programming power to it inthat you can tell it to do things after the page is loaded . So, JavaScript can run all this code that the server would normally do, and save a lot of computing power, and time, as well as free up the browser to be able to do all kinds of cool stuff without having to hog the server to get the information, or the processing power, it needs. All this enables various programs to run within a browser- these programs could request information from the server in the background without waiting for the user to hit the reload button. That's where we got things like google maps, and google mail! Dynamic Web Applications, very much like desktop application, but run from your browser!

Eventually, the standards people came to a decision. JavaScript had been popularized in some part by being the right tool, at the right place in the right time.

In the meantime, loads of people in open source community have been working with and around JavaScript, building support libraries that help JavaScript do all kinds of wonderful things. Including, nowadays, running as a language on the server side of things! Imagine having the same language running on the client AND the server side! At the time it was unheard of, but I bet you can imagine how convenient it makes things for a lot of programmers.

So there you have it!

JavaScript is so popular, because it's- in the broad scheme- convenient. It's flexibility as a language makes a lot of web processes easier. Plus, it got super well-timed screen time when it was starting out. It might not be as clean or easy to program with (linguistically) as some other languages, but its flexibility and versatility make it an irreplaceable tool (for now).

comments powered by Disqus