Is JavaScript Better than Java, C# and C++ (A.K.A. Why JavaScript is Like a Cockroach)

Okay, let’s get the controversial part resolved right out of the gate.  Why is JavaScript like a cockroach?

  • Cockroaches are practically invincible — they can withstand ten times the nuclear radiation humans can and they can survive for a week if their head gets cut off.
    • Corollary: several of the worlds largest corporations have attempted to kill off JavaScript and none have been successful.
  • Cockroaches are fast –proportionally they are three times faster than a cheetah.
    • Corollary: JavaScript enables very rapid development.  It’s mixed-paradigm (functional with object-oriented characteristics), dynamic (duck) typing and enormous developer community allow for very rapid development
  • Lots of people think cockroaches are ugly and try to kill them.
    • Corollary: Identical.

Obviously my use of cockroaches as an analogy gives the impression I don’t like JavaScript.  This, however, is completely untrue (albeit I do dislike cockroaches).  I thoroughly enjoy modern JavaScript and find it to be an extremely powerful language.  One I choose to work with more frequently than Java, C# or C++.

Is JavaScript better than C#, Java or C++?  Obviously this is a nuanced question that deserves a nuanced answer like: it depends on the problem domain, performance and platform requirements, etc.  But, I’m not going to give a nuanced answer.  I’m just going to say: yes.

Why?  JavaScript has several benefits over the other languages:

  • Paradigm Flexibility: JavaScript supports aspects of functional programming.  It also supports object-oriented capabilities through the use of closures and prototypal inheritance.  While the other languages started out class-based and migrated toward functional, JavaScript always supported functions as first-class members and has migrated toward class-based object-oriented syntax.
  • Extreme Object Extensibility: JavaScript supports duck typing, prototype modification and treats all objects as associative arrays which allows for dynamic insertion of functionality and data.
  • Ubiquity: Based upon data from GitHub and StackOverflow, JavaScript is the most actively used language.  This leads to:
  • Cross-Problem-Domain: Thanks to node.js, electron and every browser ever invented, JavaScript has strong support for developing services, front-end web applications and native applications.

While the points I’ve made above are true, I wrote this blog somewhat tongue-in-cheek.  In the real world, your choice of language and tech stack will depend upon many things: problem domain, risk tolerance, schedule and cost budgets, development team composition, etc.  But, don’t discount JavaScript as a viable option just because it’s got warts.  To use a carpentry metaphor: if your toolbox can only hold one hammer–JavaScript is the biggest, baddest hammer in the shed.

TL;DR

If you could only use one programming language for the rest of your life–choose JavaScript.

8 Replies to “Is JavaScript Better than Java, C# and C++ (A.K.A. Why JavaScript is Like a Cockroach)”

  1. I used to absolutely hate and abhor JavaScript. I was a .net (C#) evangelist through and through. Adding alerts everywhere to debug really turned me off on the language early in my career and then along came this little thing called nodejs and so I gave js another chance. Boy am I glad I did. I now prefer JavaScript to any other language because I feel so free to get the software done and not be drug into the overhead of creating all these different data structures that must be created for a strongly typed language. That doesn’t mean go away from good design principles and practices and write spaghetti code, and unit testing becomes a necessity, but JavaScript just makes the developer more free!

    1. JavaScript has improved by leaps and bounds over the last several years. I just read an interesting article talking about the extra overhead and verbosity involved with statically typed languages. One of the comments mentioned Haskell as a statically typed language that doesn’t suffer from some of those problems.

      I think JavaScript has moved a little towards more traditionally typed languages and C#, Java, etc. have moved a little more towards JavaScript. Right now, it looks like the others are playing catch-up to JavaScript though.

  2. I’m just looking joomla template to design site for just one hindu brow.? Any suggestion for template and components for Joomla?. Mainly searching for event details, picture gallery and blogs..

  3. My love for JavaScript is undeniable. I have been writing JavaScript extensively more than 2.5 years. It has everything which a hardcore programmer needs to author a kick-ass framework/application.

    1. @Hitesh – I worked in JavaScript over a decade ago and didn’t enjoy it. I moved on to other languages but returned to JavaScript a few years ago and it’s a totally different experience. I’m really enjoying it now.

Leave a Reply

Your email address will not be published. Required fields are marked *