JavaScript Comes of Age

JavaScript will be 20 years old next year (counting from when it first debuted in the Netscape browser). It’s a language with a chequered history and carries a lot of baggage from its early years, but as it leaves its teenage years behind it, I think it’s a language that has now finally grown up.

JavaScript revolutionized the web by allowing scripts to run in a browser. But after its initial popularity it soon started to get a bad reputation and was often associated with poorly written, cut-and-pasted code that was used to create annoying pop-ups and cheesy ‘effects’. The phrase DHTML became a dirty word in web development. JavaScript also had some annoying shortcomings as a programming language.

But, despite all of its problems, JavaScript has something that other languages don’t have – reach and ubiquity. It only requires a browser to run, which means that anybody with a computer or smartphone is capable of running a JavaScript application. JavaScript has achieved the dream that Java had of being available on all platforms by using the browser as its virtual machine. And it can now run without a browser thanks to the development of engines such as Node.js.

JavaScript also has a low barrier to entry when it comes to development; since all you need to write a program is a simple text editor. It is the most popular language on GitHub by a number of measures. This means that there is a lot of JavaScript code out there and many problems have already been solved, often in many different ways. It also means that help is often easy to come by and libraries of code are very well tested.

After an awkward first decade, JavaScript spent its teenage years growing up. The revolution started with the advent of Ajax, when people started to sit up and take JavaScript seriously. jQuery then got people using JavaScript to build some serious applications and Node has taken it all to a whole new level. People have started to recognize that JavaScript is a powerful and flexible language with some cool features such as:

  • Asynchronous event-driven programming
  • Functions as objects
  • Closures
  • Prototypal Inheritance
  • Object literals and JSON

JavaScript has also proven to be flexible enough to allow solutions to be written that overcome its main shortcomings. A number of frameworks and libraries have been written to address these issues and make JavaScript a nicer language to program in. Modern web browsers have also had a big effect on the language by virtually eradicating the inconsistencies in implementation that plagued it in the past (who remembers having to write multiple versions of code just to get a simple event to work, for example?). And speed is no longer an issue as the various engines used in modern browsers are already blazingly fast, and they’re only getting faster.

I strongly believe that JavaScript will be the most important language to learn over the next few years. The way websites are developed has evolved and they are now likely to be single-page web applications that rely heavily on JavaScript to do the heavy lifting on the client side, often using modern front-end frameworks such as Backbone or Angular.js. Isomorphic JavaScript is the process of using JavaScript to program the server-side of a web application and is gaining in popularity because of the advantages of using the same language for the whole application. The data that is transported from databases is often stored in JSON format. It’s possible to build an application for iOS, Android and FireFox OS using a combination of HTML, CSS and JavaScript. The Internet of Things is a broad term used to describe anything from household gadgets to small robots, most of which are using JavaScript to interact with their APIs. In short, JavaScript is becoming the language of choice, not just for the front and back end of web development, but also for interacting with a huge number of modern devices.

SitePoint has recently published my book “JavaScript Novice To Ninja,” which takes you from the very beginning and works up to the more advanced topics in JavaScript. It begins by introducing the basics of programming, covering topics such as variables, conditional logic, loops, arrays, functions and objects in the earlier chapters. It then moves on to using JavaScript to interact with a browser environment, covering events, the DOM, animation and forms. Then in the later part of the book, more advanced concepts such as testing and debugging, object oriented programming and functional programming are covered, showing that JavaScript is capable of handling these. We also take a loom at recent developments such as HTML5 APIs, Ajax, frameworks and task runners, such as Grunt. There’s also a practical project that involves building an interactive quiz application that develops in each chapter.

If you’ve always wanted to learn how to program then now is the perfect time to get started and JavaScript is the perfect language to learn. As it moves into its 20s, JavaScript has finally grown up and is starting to go places!

Sponsors

No Reader comments