June 10, 2015

645 Views

The Evolution of JavaScript

User Experience (UX) is all about the emotions and responses a user experiences or anticipates from his/her interaction with a system or a service. This includes emotional experience, perceptions, behaviors, physical and psychological responses, and much more. Simply presenting the information or service to a user these days, is not only ineffective but unacceptable. Your website or service needs to engage and interest the user. You would also want your user to feel comfortable and secure while consuming your service, which will in turn provide him/her with a positive experience.

There are many aspects that affect UX, such as content, navigation, interaction, graphics, roundabouts, web forms, and more. As many of us know, JavaScript (JS) can be employed to enhance the overall experience and elevate positive emotions and perceptions by facilitating dynamic content for users. Some examples include validating web forms, or auto-saving amended data to reduce frustration, or rendering visual effects that not only draw attention but also create curiosity, or allowing visual effects otherwise impossible with HTML.

JS is an interesting language. For much of its history it was misunderstood and undervalued and labeled a toy language, predominantly used for performing small tasks in HTML pages. But in reality, JS is a robust and powerful language. In this article I will touch upon how this “toy” language has evolved, and what is on the horizon for this little scripting language that has become one of the most trending technologies in the world!

Up until 10 years ago

JavaScript, which was initially called Livescript, was born in 1995 to address process strain on the server when the speed of the internet was a concern. The language runs on end user computers, resulting not only in more responsive websites for users, but also websites that are cheaper in terms of server traffic (slashing client/server round trips).

With JS, we enhanced the web interface. It added behavior to the web page, where the web page responds to a user instantly without loading a new page to process a request. We did not have to fill an entire form and submit it only to be told that we had made a typo in a particular field and needed to re-enter data all over again. The search box gave you suggested results while you typed, information changed constantly without user intervention (stock market tickers), we obtained content on-demand, and facilitated animations to gain user attention to a specific portion of a page, or to make the page easier to use. None of these would have been possible without JS.

However, up until 10 years ago, JavaScript was not considered a serious technology and was criticized for being inconsistent, and for security reasons. The arrival of jQuery in 2006, however, changed the UI development landscape forever, and made the building of tailor-made and complex UI elements a breeze. Websites became more interactive and intricate, while development became efficient. But JavaScript apps were still lacking in their ability to organize and manipulate data in the context of enterprise and commercial environments and in systematic code management, quickly creating room for well-defined application architectures.

The past 5 ‘Golden’ years (purely client)

The brave new world of hyper-data and complex interactions has harnessed the power of traditional JS through model–view–controller (MVC) JS frameworks on the client side. The first such framework to gain successful adoption was Backbone.js. Today, AngularJS’s popularity and acceptance outshines that of any other framework, although Ember.js has a vibrant community of contributors and users. It also seems odd that ReactJS, developed at Facebook, is taking the lead from AngularJS.

Modern JS frameworks like these alleviate code management by providing clean and distinct application architectures (often using the MVC pattern) that can simplify development to a great extent. So, by employing one of these frameworks, we not only get highly responsive desktop alike user interfaces (Single Page Applications), but also ensure well-structured and easily-maintainable code base, which can save effort and money in the long run. A good UX is all about the end user’s comfort. They comfortably use a web-app that acts much like a desktop application, updating only the relevant views as they interact with your web-app. Also, independent of real performance, the user experiences a considerably faster website than a traditional-style website, resulting in a far better UX and user retention.

All these frameworks share equal success in making truly complex user-facing applications a reality, and are radically changing the way we think about development.

Quick Fact- The Guardian, (a giant news publication) and YouTube on PS3 shifted to Angular, clearly indicating that Angular is strong enough to be able to scale to the most demanding of commercial environments.

Going real cross-platform

A web browser exists in almost every consumer-based computing device in one form or the other, making JS apps highly versatile. Building a web app for a variety of platforms like Android, iOS, Windows, BlackBerry and even the desktop becomes no different than developing native apps. It was extremely expensive, if not impossible until recently to think of a real cros-platform app. Each platform had a proprietary technology that calls for a separate code repo for every single device, thereby pushing the cost and effort for cross-platform development in every possible way.

Now, coming to cross-platform mobile frameworks like Phonegap and Cordova, it is possible that a native app for every single device can be built using the same HTML5 and JS technology, with the combination of these mobile frameworks. Such apps offer better, if not, equally immersive UX on all devices – all using standard web APIs to bridge the gap between web applications and mobile devices.

Quick Fact- Take a look at the official Wikipedia mobile application, which provides a native experience with web technologies, and is built using Phonegap.

Evolution of Server-Side Java Script

In the past couple of years, the web is witnessing many data-intensive, rich internet and high real-time applications such as multiplayer online games, virtual meeting tools, and instant messaging engines. The server needs a responder to manipulate and process such requests and update the client. Java, .Net, and other mature technologies provide a variety of frameworks for the server to work like those responders. But for real-time and highly concurrent applications, choosing an efficient server software and hardware is essential. Hiring a different skill like Java/.Net to work on this portion is not only a costly affair, but underutilizing the client side (JS) developers too is a burden on the project.

This justifies the scope for a simple framework which is highly scalable. One that doesn’t compromise on performance and speed, and that promotes the rapid development of web applications. An idea of elevating a single programming language for both client and server was what confirmed a berth for JavaScript on the server, in the form of SSJS (Server side java script). SSJS leverages JS on the server front to provide scalable and high performing data-intensive real-time applications.

One such super successful SSJS is Node JS, an extremely simple and lightweight framework, which is already adopted by giants like Walmart, Yahoo, and PayPal in their critical user facing business applications.

Quick Fact- Walmart witnessed ~50% of all its online traffic through Node.js server during the recent Black Friday sales.

JavaScript and Databases

Over the past three decades, RDBMS remained dominant for DB management, and is still useful and relevant for many of the same traditional applications. The need to realize changing business needs such as high scalability, increased velocity, big data analytics, and social interaction, demanded unstructured DB (NoSQL) in the context of low-cost commodity hardware.

Out of many popular databases in the NoSQL movement, CouchDB and MongoDB are “document databases.” They don’t store tables, rather they store documents – the JavaScript Object Notation (JSON) documents. JSON is a lightweight data-interchange format based on a subset of the JavaScript Programming Language. Though it can be used in any language, JSON is a natural fit for JS development. JSON is fast becoming the real cross-language standard instead of some Java or Python-based formats, clearly indicating the preparedness of JS to take a role on a larger stage. What’s more exciting is that many of the NoSQL DBs also promote writing queries using JavaScript. It doesn’t stop there, but JS and JSON are also embedded within other kinds of apps.

Quick Fact- The Weather Channel turned to MongoDB to get killer features out to users quickly. Changes that used to take weeks earlier, can now be pushed out in hours.

JavaScript is now sitting on all the 3 layers (Full Stack JavaScript development - FSJS) - now imagine being able to develop complex real time web apps using JavaScript. Wouldn't being able to use the same language across client, server and DB simplify life for developers? This is where the world is heading!

Embedded/IoT JavaScript Today

The “things” we have today are not going to be dumb anymore. They can talk to each other with REST services in the cloud, with internet browsers, with mobile phones, and with a whole lot of other devices. JS is the only language that can be leveraged to write the software for all of them, with JSON being the interchange format.

Next gen devices are already hot in the market. One such popular device, the Intel Edison/Galileo has already adopted Node.js, allowing web developers to code IoT programs. You can either use your web development skills to make hardware devices with Tessel, or develop a home automation system running on Node, MongoDB, HTML5 and web sockets. You could tweet to turn on your lights using a Ninja Blocks device (a small computer device that lets you invoke and respond to devices in the real world - all from the cloud), through JavaScript. The Raspberry PI - popular for being the cheapest platform - also supports Node.js. You can now develop a drone that can aerial survey your city and post pics on social media, if that is what excites you.

The possibilities are just endless.

With IoT gaining momentum, in my next article I will cover why I think JavaScript is suitable for IoT and the advantages.

Conclusion

JS started off as scripting to stitch HTML blocks and grew to be a multi-paradigm language to develop real cross-platform apps, full stack web apps, and drones. It has entered an exciting cycle of evolution and innovation - stepping into every technology environment, elevating and evolving UX possibilities.

Everyone knows how rapidly technology evolves, but we in UxD are envisioning and celebrating the curve. We are not only prepared, but also exalt in these good times, believing that there is plentiful innovation ahead of us.

References