JavaScript Myths Busted!

In the last decade, JavaScript(JS) has grown really fast. On the first look, the language looked half-cooked and good enough for doing few basic things in the browsers. However, the willingness to have a thick client and the popularity of the UI frameworks like Angular, React, Ext JS, and server side languages like Node.js, etc have given a huge boost to the JavaScript’s growth.

With all this popularity in place, it is not completely debate free and spotless. There are misconceptions or myths – some of them have logic and some of them just exist because of certain stereotypes.

Loose Typing

Myth: People coming from the strongly typed language background feel that JS is a second class citizen and it is error prone as it doesn’t take advantage of the compiler to detect errors.

Fact: JavaScript’s loose typing is a boon rather than a curse. The compilers detect errors like trivial mistakes. More importantly, just because a language is strongly typed, it doesn’t imply that testing is not needed. Hence, a basic testing of all the use cases that you intend to implement, is good enough to identify and fix any such errors.

Lacks support for Object Orientation

Myth: Javascript doesn’t have class system like other popular languages and the object oriented concepts are faked.

Fact: JavaScript provides Prototypal inheritance. It has class-free object system, in which the object inherit property directly from the other object. Of course, you cannot apply the traditional OOP concepts directly. You do need to work with the Prototypes.

Linkage through Global Variables

Myth: Javascript relies on the linkage through global object. Global variables are known evil in any programming language and any best practice suggest to minimize its usage.

Fact: It is true that Javascript relies on global objects for linkage. However, it provides ways to minimize this and you shall be using global only when you really need a variable to be global.

A scripting language

Myth: Javascript is a scripting language. It gets interpreted at runtime and hence it will always be slower than compiled languages.

Fact: Let’s accept the fact that Java and few other popular languages could not achieve what JavaScript could achieve inside the browser. It is true that JavaScript gets interpreted at run-time, however, compared to compiled languages it trades some level of performance for expressive power and dynamism.

Is Good for user interactions in browser

It is fact that in the browser, it gives unmatching experience. However, let’s look at some of the popular technologies like Node.js, Meteor.js, Express.js, grunt gulp, Electron.js, NativeScript, etc and you will find that JavaScript is actually everywhere. Add to this the fact that JavaScript is being used for developing Mobile Apps, Bot Frameworks, Internet of Things devices, 3D Games and even Virtual Reality and you will stop thinking that it is just for the interaction in browsers.

Is subset of Java

Myth: People who have not done anything serious in JavaScript, often feel JavaScript is a subset of Java.

Fact: JavaScript has nothing to do with Java. Some of the syntax may look familiar, but the similarity ends there. Originally, its name was LiveScript and it originated inside Netscape. Of course, Java being popular, it was renamed to take the advantage of the confusion and it did work like wonders.

Not as powerful as some of the other standard languages

Well, every language exist for a purpose. However, when it comes to browsers, nothing can beat JavaScript. Further, look at the github and other community to see how much reusable work exist off-the-shelf. The community is continuously adding capability and extensions into JavaScript and as of today, there is hardly anything which you cannot do using JavaScript that you can do with something else (in browser).

Being single threaded, it slows down the application

It is true that JavaScript is single threaded. However, look at the way JavaScript works with Asynchronous events (through its amazing callback mechanism). While this keeps ensuring that processing unit is efficiently optimized, there may be situations where multi-threading like environment will make things better. JavaScript does provide support for things like Web Workers, which kind of acts like multithreading in JavaScript. 

Conclusion

Being a ardent follower of JavaScript, I might look biased. However, the fact is that JavaScript has earned a huge respect in the development community. Sometimes I do feel that it is trying to overachieve certain things. However, when I see the results, I often get amazed by the capability it provides. 

Forget about the myths,Keep using JavaScript and keep rocking!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s