Sometimes there is a better choice than Javascript

alexcoder04@programming.dev to Programmer Humor@programming.dev – 587 points –
54

Wrong, annoying animations was Flash's thing. Javascript was made for annoying popups and alert boxes

Also for these animated status line texts that were supposed to show what's being loaded currently.

"Sometimes there is a better choice than JavaScript"

We call it TypeScript

I heard they're looking to add typing to JavaScript in a very similar style as TypeScript. Basically running TypeScript in the browser without tsc.

There's at least a proposal which I hope they'll continue with.

I was there for the first wave of SPAs, I even learned angularJs and Knockout. It did feel like a major atep forward, being able to make highly interactive applications. However, things quickly went off the rails when the tools stopped being about managing heavy client state, and became the default for everything, even when it ment using JavaScript to build extremely basic functionally browsers did natively with html, but extremely worse(e.g. navigation). The modern Web really is a victim of hype and trends.

Unless your app needs to work offline, or you have to manage dozens of constantly changing client side data points concurrently, your site doesn't need to be a big heavy js framework. My rule is if it looks like Google Maps, you need a SPA. if it looks like Gmail you need REST/HATEOS. and if it looks like google's mainpage, you need a server side rendering.

At some point you might see the light, and go back to making your websites simpler, but Im not hopeful. Until then I'm building the majority of things with HTMX and alpineJs.

I make fully static sites using react

Yeah, I've personally been using react and vite-plugin-ssr to static render things and while there's been a few bumps it still feels pretty nice

I thought that's what GIF was created for... Even if the original introduction of it is saying something completely different.

Doing Odin Project now and the constant shiting on JS online is sort of crushing my motivation. ๐Ÿ˜ซ

JS is fine. But as with any tool it's not the best for every scenario.

The flak JS tends to get us mostly because of the rise of popularity is Node.js leading to backend JavaScript beginning commonplace. which it's overall a poor choice for backend when compared to many other languages as the strengths that JS has are more tailored to frontend.

Don't let it get to you. This is mostly just a circlejerk by people who don't even use JS themselves.

Donโ€™t worry about, JS is a fine language and is used by all of the top companies. If you want to get a job as a software developer you have decent odds if you learn JS

If you don't hate a programming language you simply haven't used it enough or are delusional. Every language sucks in its own special way, js ain't special.

cue โ€œif those kids could read theyโ€™d be very upsetโ€

Honest answer: JS is a shitty language and I despise it. BUT you can learn a ton of stuff with that, all the features (loops, conditions, variables, etc.) that exist in other languages. You will hate JS one day too, but right now it's good to learn, and when you'll switch to other languages, you'll be happy you learned something.

So yes, JS sucks, but no, it won't be useless for your future. Keep on working, programming is really fun.

css can do animations, and it's much more performant then js. I hate how over-used JavaScript is on "modern" websites.
some websites are even straight up unusable or don't display anything with js disabled....

Some websites, JavaScript is necessary for doing things without overloading a server. Mostly SPAs/PWAs and such. Iโ€™m using Voyager for Lemmy right now, which needs JS, but it gives me a great experience.

But yeah, JS is often overused. Luckily, with new technologies coming out like Astro and HTMX, we should hopefully start seeing less JavaScript on pages that donโ€™t need it.

Still wayting for a native solution to AJAX.

No, not Java beans.

htmx just generates js too

However, it uses a lot less JS. Itโ€™s only a few lines of JS to replace an HTML element, but a lot more to parse a bunch of JSON and then alter the HTML to reflect that.

PHP dynamic sites, Ruby on Rails, or MVC in whatever language works for you is really what we should be doing

Great, the programmer humor has inherited "JavaScript bad" from Reddit. Lemmy is already enshittifying.

And python was created to teach programming. And PHP was something a guy used to maintain his webpage. If a language is useful it will gain popularity, and I never used a language which I didn't find frustrating at some point.

There are only two kinds of languages: the ones people complain about and the ones nobody uses.

-- Bjarne Stroustrup

True, but I see this quote repeated so often that it kind of bugs me. It seems to be used in a thought-terminating way. As if we shouldn't criticize languages. As if they aren't tools that are able to be improved upon, or they're all made equal. But I'm sure Bjarne Stroustrup needs to fend off hostility and unfair criticism as much as any programmer with a successful language.

oh i never considered that reading of the quote

i read it as more: complaints about a language, particularly the amount of complaints, don't mean it is a Bad Language that should be dropped in favor of something else

in fact the complaints validate that the language is being used by people, and that--the number of people actually using the language to Do Things--is imo a decent proxy metric for the usefulness of the language

so please complain about your languages' shortcomings! i hate so many things about terraform / sh / python / golang / java and will gladly rant at length, and then go right back to using them

except groovy

fuck groovy

Wait, wait, don't confuse terms. I wouldn't want to hear the use of enshitification the same way people are wrongly using "gaslighting."

Yes, I agree with you on the sentiment. Sucks that the same bs posted on reddit is creeping into lemmy.

But the platform is the same. Lemmy is not adding ads, or removing api access or shit like that.

Yeah. I don't like writing JavaScript and I hate when I'm forced to use it to do something that could be handled otherwise except reasons. But especially with later versions it's not the worst thing in the world. I work in ruby on rails and love hotwire that lets me avoid js more than before. But still js isn't literally Hitler like people make it out to be

JavaScript is an abomination and real jobs don't use it

Hey stop being sarcastic! This is a serious programing community here... Wait.