DEV Community

Henrique Leite
Henrique Leite

Posted on • Originally published at henriqueleite42.com on

Why JavaScript is a terrible language

I could spend a day talking about how JavaScript lacks performance, has terrible memory management, and relies on a thousand libraries to do the basics, but in this article I'll focus on the core: The Original Philosophy. If you want to learn more about how JavaScript works under the hood, I recommend this series of articles, this talk and this video, all of them amazing of explaining the internal behavior of JavaScript.

The creation

The old history that everyone that works with JavaScript already knows: JavaScript was created in the 90s by Brendan Eich with the objective of bringing some interactivity to the web that at the time were composed only by static HTML and CSS.

The best part is not that it was created by 1 person (nothing against Brendan, he truly did something amazing with the resources that he had), or that he had 10 DAYS to develop it, no, the best part is that they needed the language to be adopted, so they put any features into the language that was asked to them, like implicit type conversion.

What can learn with this is: The bases of JavaScript is a language created following the best method of development: GoHorse. No big picture, no defined goal, no planning, no worries about it being good, just about it being on the market.

We developers know more than anyone how good products can be when you follow no process and just code as fast as we can without thinking, right? The best products are made this way, I'm sure that it's the best of the best. No, It isn't.

"It improved over time"

Ok, the creation of it was terrible, but hey, JavaScript has more than 30 years, it had a lot of time to improve and become a better language, right?

No, things move veeery slow on the developer's community, we almost kill each other when trying to get to a consensus, it takes years to decide the best option to do something, or you can simply do what JavaScript does: Go implementing stuff.

JavaScript has more than 30 years and the people that use it still tries to make it fit every scenario, when it almost not fit the original case that it was created to fit. JavaScript keep trying to turn 180° and make it usable on the server, on CLIs, on pipelines, everywhere!

The language was created to execute short-lived simple scripts to manipulate the DOM, not to stay running and execute complex tasks, live web servers, CLIs or pipelines. No matter how much you try to make a workaround to make it fit the scenario that you want, you still will be trying to fit a square into a circle.

The alternatives

Honestly, you have many alternatives that aren't scripting languages that for more to the BackEnd, pipelines or CLIs. Unfortunately, for the Web we are stuck with JavaScript, but it's OK, it doesn't affect us that much (I hope).

For REST APIs, you can use Java, Ruby, Elixir, Golang, even PHP (yes, it's a better option than using JavaScript on the BackEnd). Try to choose something that was created to fit your case, and not adapted to fit your case.

A tool specifically made to solve a problem will always be better than a generic tool that has something kinda can solve that problem.

Conclusion

JavaScript was an amazing innovation back in the day, Brendan Eich did something magical with the resources that he had, and thanks to it, we have the web the way that we have today.

It's also a good start for new developers: It's simple, has a package manager so you can rely on others to do hard things for you (like checking if a number is even or odd) and you can run it directly on the browser to test things.

But overall, any serious company or project should not use JavaScript to power its system. It's a workaround, something glued with gum and spit, if you want your system to have a good amount of reliability you should not use JavaScript.

I know that you may have many arguments, like "Netflix/Google/Facebook/AnyBigCompany.com uses Node on the BackEnd!", and I know it, I just don't understand why, and I would love to have the opinions of the amazing developers that work there about the topic.

Thanks for reading! If you have any comments about the topic, please, share below and let's discuss more about it.

Top comments (0)