DEV Community

Rob Kane
Rob Kane

Posted on

JavaScript - The Golden Cage

Dear fellow JavaScript Developers. Please take the time to learn other languages.

Perhaps not if you are just starting out. Wait until you are proficient in a single language first.

There is a whole "generation" of developers now who don't remember a time before React, before NodeJS, before ES6 modules, before async/await, before NPM, even before JQuery.

JavaScript was a real mess back then. It was something you used only when you really had to. A workaround. The only people who thought JS was cool were web designers.

Over time, sensible patterns developed, I, like many others grew to love JS. You could write clean, elegant, functional code (despite the lack of proper FP support) and use OOP (despite the lack of proper classes). If you needed to, you could use static types (despite being a dynamically typed language).

No folders full of functions you needed to copy and paste across projects. You could stick it in a package and share it with other people. No flying V, no callback hell, no 5000 line files. Awesome!

NodeJS meant that for simple use cases, it was easy to write full-stack JavaScript apps. All the backend developers had to stop the "JS devs aren't real devs" nonsense and the world was a happy place.

But here is the thing. This wasn't that long ago. There is an entire world of other options out there and they have been refined, perfected, optimised, battle-tested and documented over many years. Solved when JavaScript was something you used to show an alert at the top of the window. These "other worlds" have also been moving forward in that time and new worlds that solve other problems have been created.

JavaScript from conception to now is all one big hack. Sticky tape, bolt-ons, polyfills, workarounds. The result is something incredible and versatile, but it takes ideas from other languages and paradigms and does the best it can at providing something similar. Never as good, but simply just good enough to be useful.

There are so many useful, productive tools and patterns that are just not available to you in JavaScript, or just not done well. In many areas, JavaScript is a lot like spinning your wheels without ever really getting anywhere. Until you step outside of that world, you have no idea how inefficient it can be.

The opposite is also true of course. Some things can be achieved so easily in JS that would take ages in some other languages. Every single one has strengths and weaknesses. There is no "best" language. There is no language that does everything well. Only n00bs think like this. Yet for many JavaScript developers (and increasingly Python developers), this seems to be a common mindset.

Learning JavaScript as your first language is probably the most sensible commercial decision you can make in the current environment. Just don't make the mistake of thinking that just because you can do it in JavaScript, you should – and worse – you don’t ever need anything else. People now decide that JavaScript is the language they will use before even knowing what they are going to be building. This can be a very costly mistake.

I love JS (now), it is my main source of income, and it won't be going anywhere. It has been an incredible place to be over the last decade. But learning other options, other languages, other paradigms, other entity representations, other patterns, other ecosystems, other abstractions, other data structures, other problems, also teach you about the strengths and weaknesses of JavaScript. It clarifies design patterns and shows you new ones. It introduces you to a whole new level of productivity and efficient problem solving.

Let me say it clearly. Learning languages other than JavaScript will make you a better developer and make you a better JavaScript developer. Guaranteed.

Right now, the JavaScript world that for so long has been a hotbed of fast-moving innovation and problem solving, feels like it did prior to all that innovation. A hot mess.

People are going in 20 different directions to solve problems that have been solved and perfected for many years.

  • 10 different "Rails, but in JavaScript" frameworks.
  • Writing DSL layers because JavaScript doesn't support what they are trying to achieve
  • Huge, bloated frameworks to force other bloated frameworks and libraries that were specifically designed to solve the problem of not wanting static pages into the shape that we had before those things, so that you can generate a static page
  • 5 different implementations of the Phoenix LiveView model in JavaScript. A solution that was painstakingly created and evolved specifically to avoid writing JavaScript.
  • Huge microservice architectures, built from overengineered monorepos, with complex messaging systems, complex monitoring and deployment pipelines, deployed to 20 different layers of ever changing AWS services, configured through 4 different abstraction layers. All to "simplify" building a concurrent, distributed system. In 90% of cases, you could have achieved the same (or better) outcome with one well structured app and one deployment, but only if you didn't use JavaScript.

The reason for all this madness is simply because they only know JavaScript. They only know React. They only know Node. They only know Angular. Even worse when they only know Next, or CRA, or AWS and have no idea why they even used those things. What problems they solve. Just that "everyone else does, so I should".

Stop. Look around, explore, learn. Expand your horizons. The wheel has already been invented. Strive to make it better, but don't keep reinventing it and repeating the mistakes from the first time around.

If all you have is a hammer, everything looks like a nail. If you are going to build amazing things, you need to gather a toolbox.

Thanks for reading.

Top comments (0)