DEV Community

Cover image for Stop using JavaScript for everything!
Sadeedpv🥇
Sadeedpv🥇

Posted on • Edited on

Stop using JavaScript for everything!

In the world of web development, JavaScript has become the go-to language for building interactive and dynamic applications. It can also be run in the backend, it can be used for desktop applications, mobile applications, multipurpose programming and even Machine learning. However, the trend of using JavaScript for everything might not always be the best approach.

The JavaScript Craze

JavaScript's versatility and browser compatibility have made it an indispensable tool for creating modern web applications. From front-end interactivity to server-side logic, JavaScript has expanded its reach. The thing I hate about JavaScript is that it is somehow being used for stuffs that we shouldn't using (like Machine learning with JavaScript?).

The Downsides

While JavaScript offers numerous advantages, relying on it exclusively can lead to certain downsides:

Performance Overhead

Using JavaScript for complex tasks can lead to performance bottlenecks, especially on resource-constrained devices and slower networks. JavaScript is an interpreted language, which means that the code is executed line by line at runtime. This can lead to slower execution compared to compiled languages, as each line of code needs to be interpreted before it is executed.

Maintenance Complexity

As projects grow, JavaScript codebases can become hard to maintain and debug, increasing development time and costs. Maintenance complexity in JavaScript refers to the challenges developers face when managing and updating code over time. Due to JavaScript's dynamic nature, lack of strict typing, varying browser environments, and its inconsistency, maintaining JavaScript code can become complex.

Memory inefficient

One of the major drawbacks of JavaScript is its memory inefficiency. JavaScript can be memory inefficient due to factors like memory leaks, unnecessary object retention, and improper handling of large data sets.

Conclusion

JavaScript remains a powerful tool, but it's essential to use it
judiciously. I love JavaScript but the enthusiasm to use it
everywhere is mindboggling. Other languages exists for a reason. You don't have to use JavaScript for everything. Most of the newcomers in tech end up only learning JavaScript.

What are your thoughts on the JavaScript-first approach? Share your opinions in the comments below.

Top comments (22)

Collapse
 
artydev profile image
artydev • Edited

Those who can avoid JavaScript, know perfectly when it is worth using it🙂
Mastering Javascript is an art.
If you want to reduce memory footprints, there are many ways to do it, look at transducers, generators...
There are many gems, that are not very widespread in Javascript, look at this for example Channels

Collapse
 
synthetic_rain profile image
Joshua Newell Diehl • Edited

I have the sense that there comes a time in every developer's journey when they realize that any specific technology is only as powerful as it's ability to solve the problem at hand.

JavaScript often gets away with being "good enough", and is sometimes used not because it's the best choice, but because a team is most experienced with it and project requirements demand swift delivery.

JavaScript reigns supreme within the browser, but it's strength wanes, as the OP mentions, when a solution requires optimal performance, such as in CPU-heavy processing. Additionally, JavaScript itself, without the help of libraries/apis that are written in more performant languages, simply cannot speak directly to a machine's hardware.

Even if we are to wrongfully conflate JavaScript with Node, this remains an inherent limitation of the language, as what few low-level capabilities Node offers are written in C/C++, and the user must rely on their support by the Node community.

Collapse
 
sadeedpv profile image
Sadeedpv🥇

This 👆👆💯💯

Collapse
 
lukeecart profile image
Luke Cartwright

From a maintainability stand point, if your back end and frontend are all written in JS then that means that JavaScript developers can have good experience across the board rather than having different languages.

Same with mobile development. Write JavaScript once with react native and you have an iOS and Android app. No need to have 2 app development teams, one Java experts and the other swift experts. That's game changing I think.

Collapse
 
adampatterson profile image
Adam Patterson

It's probably less about the code and the structure as it is about the build tools, dependencies, and even architecture.

Collapse
 
cjsmocjsmo profile image
Charlie J Smotherman

Or use Flutter. One code base builds for mobile(IOS, Android), desktop(linux, windows, mac) and for the web. No JS needed.

Collapse
 
lukeecart profile image
Luke Cartwright • Edited

True. But using Dart 😓🤮🤮

Typescript just is awesome

Thread Thread
 
cjsmocjsmo profile image
Charlie J Smotherman

But it solves the 2 development teams, the swift expert, java expert problem you mentioned above. It gives your team one tool to use.

Dart some like it some don't.
Typescript some like it some don't.

But the real question is, is Flutter the right tool for the job?

And of course that answer will be different depending on who you ask.

Happy Coding

Collapse
 
vsaulis profile image
Vladas Saulis

As from my experience 90% of people don't know how to use Javascript.

Collapse
 
overflow profile image
overFlow

please tell us more!!!

Collapse
 
vsaulis profile image
Vladas Saulis

My advice - start with vanilla JS (pre-ES6).

Thread Thread
 
overflow profile image
overFlow

and the the next step should be ??
Because I do not think anyone will use Vanilla anything to hire me or am I wrong?

its weird to see how we learn vanilla CSS HTML and JS and then replace it with Frameworks.
LOL I was checking out a bit of Vue yesterday and it seemed like a redundant forceful way of trying hard to use JavaScript for no reason.

What I saw was something akin to forcing JS to do a job that can be done by CSS without the fuss and involvement of JS

Thread Thread
 
vsaulis profile image
Vladas Saulis

You are right about frameworks, and Vue particulary.
But there are not so brutal frameworks, f.ex. ExtJS, but it's commercial (not totally).

Thread Thread
 
overflow profile image
overFlow

if its like that for all frmaeworks then its gonna be pain for me to learn. im soon to take a peek into what React has to offer for Us. bu i fear meeting what I discovered in React.

When people said Frameworks. I expected Templates. You want a header?? You get different types and fonts on offer and styles. with the press of a button. You want a carousel? you get different types of kinds with pre-made functions and purposes and abilities etc...
But What I saw in Vue scared the bejezuz out of me. I saw JS being used like a middleman.

Thread Thread
 
vsaulis profile image
Vladas Saulis • Edited

ExtJS does exactly like that. Link: sencha.com

Collapse
 
zisra profile image
zisra

Care to elaborate?

Collapse
 
vsaulis profile image
Vladas Saulis

Nothing to elaborate. Thousands come from React/vue and know nothing of Javascript. Then they write such articles.

Collapse
 
cjsmocjsmo profile image
Charlie J Smotherman

If you really want to get away from JavaScript have a look at yew.

As of late I have been experimenting with yew. In a nutshell it's HTML, CSS and rust.
It's component based so if you have ever used react, or svelte then you will feel right at home the only difference is instead of using javascript you use rust.

Is it better, I don't know, but it is an interesting new way of developing and deploying websites.

Happy Coding

Collapse
 
sadeedpv profile image
Sadeedpv🥇

Wow! Why didn't I hear about this before? 🤔

Some comments may only be visible to logged-in visitors. Sign in to view all comments.