Diving into Modern JavaScript

Over the past 10 years I have been writing JavaScript every now and then. If you were doing something for the web, it was almost inevitable that at some point you would have to write some JavaScript here and there to make some feature work nicely in the frontend of your application. However, the problem with the language was that it didn't feel as mature as other languages due to the lack of proper tools, libraries and frameworks. There was of course jQuery which made things a bit easier, but it alone wasn't enough.

But things change. In the software world they change a lot and fast. There is no such thing as "I will learn this one language and write it for the rest of my life" unless you happened to learn COBOL in the 1960's. Most likely you'll have to master multiple programming languages during your career. This emphasizes the importance of continuous learning. Keeping up on the ever changing software trends is equally important but it also means that you should be able to evaluate new technologies critically and not to jump at every one of them. I will focus on this a bit later on this post, but let's have a look at the JavaScript history first.

The rise of JavaScript has been one the most visible changes in the software industry during the past five to ten years. JavaScript has become very popular in web development. It's is the only language which can be written in both backend and frontend thus eliminating the need for two different languages. Thanks to React Native and NativeScript, it's also conquering the mobile space as a cross platform development language. On desktop there is Electron.

The popularity of full stack JavaScript started to rise rapidly about 5 years ago. This is mostly due to Node.js which moved JavaScript out of the browser context allowing developers to write the backend of their applications in pure JavaScript. On the other hand, Angular 1 made the frontend development much easier at the same time. Nowadays there are dozens of good JavaScript frameworks and thousands of libraries to choose from. Most of these packages can be found from the world's largest software registry with npm, the JavaScript package manager.

In a nutshell, JavaScript is not going away. It's here to stay.

language popularity
Stack Overflow Developer Survey 2017 shows how the popularity of JavaScript has been growing over time. In contrast, C# and C are declining. Stanford CS department announced recently that they are going to try to use JavaScript in the introductory courses instead of Java.

Any application that can be written in JavaScript, will eventually be written in JavaScript. - Jeff Atwood at his blog in 2007

As far as I can see, the quote above is still accurate. The open source community around JavaScript is very active and new libraries and frameworks are being released all the time. The rapid growth, however, introduces some new challenges to software developers as well as to companies which are using JavaScript to develop new products. Adopting something new too early may lead to problems later.

For example, Angular's 1.x versions are incompatible with Angular 2.0. Many people were fooled since Google is behind the framework. CoffeeScript, a dialect of JavaScript and one of the first generation transpilers, is another good example. According to Stack Overflow Developer Survey 2017, CoffeeScript is now one of the most dreaded languages while it's still in use in many projects. If you developed lots of stuff with these technologies (many devs and companies did), at some point there will be a hard decision to make: keep maintaining the legacy codebase or do a full rewrite? Or maybe switch to some other stack?

In any case, there will be money involved. As a company you could keep paying more and more for the maintenance of the legacy codebase or pay more for a full rewrite. This is not only a JavaScript problem, but it's more visible with it because the ecosystem was not mature enough when people started to use the first JavaScript frameworks and libraries in production environments in early 2010's.

While it's natural for humans to resist change, the quality seems to be partly missing from developers in the modern software world. If the development language is JavaScript, resistance is futile. But is the fast change so bad after all? This whole web thing could be described as a giant agile process. Iteration after iteration. You jump on it at some point. Just remember not to do that too early in case of new technologies. As the ecosystem evolves, the sprints become longer and the things start to look a bit more stable. At least I hope so.

I have observed the growth of JavaScript for some years now. During this time I tried some frameworks and libraries: Angular.js, Meteor.js and Ember.js to name a few. Those were just small experiments to keep up with the JavaScript world. Last year I started to learn JavaScript on a bigger scale due to some projects which involved somewhat complex SPA frontends which consumed REST-like API's.

The frontends could not have been simply done easily without modern JavaScript. Some of them were written with the help of React which feels like a very natural way of writing user interfaces. React (and ES6) is also one of the reasons which made me think that JavaScript is now mature enough to start learning and using it more widely. I never thought that I would be writing about JavaScript in this blog, but as said, things change.