This week, we consider two very important languages: JavaScript and PHP. The purpose of this series is to look at new and important languages, and contrast them with established languages (especially languages they are designed to replace). What’s interesting about this contest is that these two languages are the same age: they both had their first release in 1995, and have grown steadily since.
Given the fact that both of these languages are now 20 years old, how can I claim that JavaScript is a “new” language, threatening to usurp PHP? It’s not so much that the JavaScript language itself is new, but how it’s being used is new. When Brendan Eich wrote JavaScript for Netscape Navigator in 1995, its intended purpose was a browser scripting language. That purpose stuck — up until 2009, when Ryan Dahl, working for Joyent, created Node.js, which sparked the server-side JavaScript revolution. I can’t overstate the importance in this shift: it’s what transformed JavaScript from niche language to a general-purpose language.
For those of you who may be confused about the difference between “server-side” and “client-side” — or the importance of that distinction — let me take a moment to explore this issue. While the line between “client” and “server” has blurred over the years, the Internet is still a client/server model. Your computer is the “client”, and somewhere in the nebulous, vast Internet, is a “server”. This server is sending information over the Internet to clients all over the world — one of which is your computer. Both client and servers are computers. Servers are typically intimidating looking boxes in giant racks in giant, air-conditioned warehouses, and clients are…well, desktop computers, laptops, phones — even watches now. The important point is that clients and servers — for all the differences in their physical appearance — are just computers. And one common property of computers is that they run programs.