From undefined to something.js
I want to dedicated this article to one of the best and humble programmers I’ve ever known, who guided me through the inscrutable paths of JavaScripts.
I think I’m starting to be a little too tiresome with JavaScript.
I realised this when I started meeting people and introduce myself following as “what’s the world most popular language? French, English, Spanish or JavaScript”, “have you ever listened about the great history behind JavaScript…” (playing in the background Conan the Barbarian OST) after what many of the them answered me with the typically “I know Java, it’s a programming language” ¬¬
What’s the difference between Java and Javascript?
Oh my glob, what year is it? and I’m still explaining this but I like quoting one of the top rated answer of stackoverflow (probably new generations won’t catch the joke)
One is essentially a toy, designed for writing small pieces of code, and traditionally used and abused by inexperienced programmers.
The other is a scripting language for web browsers.
JavaScript has a dark past, it was designed in 10 days in 1995 by Brendan Eich, one of the Mozilla’s daddies.
What a mess! you might think but a really great job for that short period of time. It was called LiveScript, however because Java was famous by that time and trying to reach developers they renamed it to JavaScript.
JS was deployed to Nestcape, which later on submitted to Ecma International.
Why were there so many detractors in JavaScript?
Come on sit on my knees, child, I lived during the Browser’s War.
Have you ever try to make work a website on Internet Explorer 6? Mix pain and absurdity.
Internet Explorer
After Nestcape was launched, Microsoft decided to go onboard implementing their own version in a dirty way based on a reverse-engineered implementation of Netscape’s JS, two months later Netscape submitted JavaScript to Ecma International but Microsoft decided to go forward on their own. There were also differences in HTML and CSS, hence two totally different ways of doing the same thing.
An immature language
JavaScript was very slow and immature at the beginning, it lacked from many basic functionality that other languages had. It attempted to be quite functional but unfortunately for us it failed after the pressure of attracting new programmers. So that’s why you have some functional things in JavaScript. Yes, JavasScript is weird (and powerful).
The rise of web browsers and the standardization
Browser competition remained the same during almost a decade, improving step by step, which FireFox (Nestcape) gaining ground but it was not until other browsers joined the game as Konqueror when everything started to improve radically.
Apple instead of starting from cero decided to use Konqueror’s engine (ECMAScript based) for Safari. In those days Google Chrome and later Opera decided to follow Apple guidelines supporting the standard as well.
In the coming years FireFox and Chrome together with most of the browsers started pushing out our big enemy installed by default in the mayority of the computers: Internet Explorer.
Microsoft was not interested in “the internet phenomenon”
Internet speed raising, mobile devices and web browser engines capable of execute JavaScript as fast as it were compiled made possible to expand JavaScript beyond any possible unimaginable frontier.
JavaScript even in the soup
Users do not consume desktops like it used to be, they really don’t care too much about local applications, users are on the Internet 90% of the time.
Think about any desktop application, almost each of them has its own web version that doesn’t requiere installation or a specific operating system: Office 365, Google Docs, Photoshop Online, etc.
Who can complaing about freedom, compatibility, accesibility and not installations at all?
The reability of the web is so powerful that even many of the desktop apps are becoming web based: Spotify, Skype, Steam, Atom, etc.
And not just the desktop’s, most of the phone apps are web based as well. Check the top on Google Play or Apple Store, they are web based: Facebook, Whatsapp, Messenger, etc.
The same for almost any device: smart tv, wearable, tablet, etc.
You code once and use the same code for any device: Electron, Cordova, etc.
Not any programming technology has achieved this expansion before as The Web Big Threesome (HTML, CSS and JS) is doing. Just to give you a quantitative example, nowdays the mayority of repositories on Github are in JavaScript and growing faster than any other programming language.
What is still needed to be conquered?
However, besides JavaScript is also on the server side with Node and apps can use client and cloud powers, there is still many things to conquer from others programming language areas. Above all I would like to mention the hardware access in general. It has to be implemented by browsers with HTML5 APIs and JS facilities.
For example, some of the features not available yet but in progress: bluetooth, NFC and proximity sensors. You can use them depending on the device but not natively (Cordova plugins).
Beyond something.js
I’m a bitch, no really, to be true, I don’t care about JavaScript at all, I’ve been programing with C++ and Java (not more painful than ECMAScript 3.1) however it is one of the most versatile and enjoyable languages ever created.
Anyone can open a browser and start writing a simple alert('Hello World')
in any system or device, even if they do no have internet access.
The truth is that the necessity of the web was what made JS became so powerful and because JS is even today a relatively young language… it’s taking best aproaches from other languages (not always ¬¬). So, very likely, from my humble opinion in the coming years web technologies will conquer videogames (not what Unity did with JS), research and computer desktops.
However, there are not perfect programming languages and JavaScript is not an exception, it has tremendous design errors and unexpected behaviours. Just to give you one of my favorite example, open a console and type:
['10', '10', '10', '10'].map(parseInt)
Don’t panic :P you can use Number
instead.
What I would recommend you to use is a subset of JavaScript updated.
JavaScript: The Good Parts 2 (coming soon).
Whether tomorrow JS is defeated or not by another opensource better and easier technology (Elm, could be you?) no one will ever have as many libraries and frameworks as JavaScript (hopefully).
Keep in touch
Did you fall asleep reading these short story about JavaScript? What do you thing about the Black Mirror future of web technologies? Leave a comment to let us know!
And if you want to denounce next time I publish something, you can also follow me on Medium.
T-Shirts
★ Now you can have some of my coolest T-Shirts for programmers, check it out!