top | item 20807953

JavaScript Is Bad

81 points| randomdudeonhn | 6 years ago |ror6ax.wordpress.com

98 comments

order

starbugs|6 years ago

A certain subset of technical people seems to be unable to understand how it can happen that — what they believe to be — technically inferior solutions can win major market share and become the defacto standard for decades to come.

Don't get me wrong: I am not saying that JavaScript is great, but I am also not satisfied with the status quo of the discussion around it.

I don't really see how this contributes anything to improve the situation. Yes, a prototype was done in 10 days. Yes, the web scene has been vibrant and iterating extremely fast for a long time and that has left marks on the quality of the technology more often than not. But hey, instead of complaining, come up with something that is capable of transforming it to the better!

That's not easy and I suspect it's not solvable by technical means solely. So it's hard. And it's easier to just write blog posts that complain again and again.

giancarlostoro|6 years ago

> That's not easy and I suspect it's not solvable by technical means solely. So it's hard. And it's easier to just write blog posts that complain again and again.

That would be WebAssembly and its true since it is progressing a bit slowly but thats a good thing. If they get it right you can write JS to WebAssembly thats modern and backwards compatibility wont matter or write Python to WASM, or Rust, Go, C#.... And so on.

Someone mentioned here on HN ages back that WASM will probably be the next stage after SPA frameworks. I think C#'s Blazor project is a strong indicator that what is to come will be pretty damn good and pretty damn powerful.

Granted it will take a while as WASM matures and we make sure to push users towards modern browsers. I think tech like Blazor will even see old tech like ActiveX or Java Applets find their replacements in WASM. Heck we saw the other day a full blown Flash Player Emulator in Rust for WebAssembly. That was quite well done!

The future is in WASM and it will take a bit to get it just right but at least we can work on making sure it is designed properly. Do what Microsoft did: they learned from Javas mistakes and C# became a really good language. Lambdas in Java took forever to be added.

johnisgood|6 years ago

Complaining is recognizing that there is an issue. This article is trying to raise awareness of some issues. It is a start! I do not think that not providing a solution to all (or some) issues invalidates anything that has been said. Having a solution is not a necessity. I may point out flaws in a system, but I do not need to have a solution ready for it, do I? The flaws exist, with or without a solution.

crusader1099|6 years ago

> But hey, instead of complaining, come up with something that is capable of transforming it to the better!

This reminds me of the "submit your own PR if you want this feature so bad" mentality that I see on a fair few open source projects. For most people, this isn't feasible. Creating a new programming language, let alone one that could one-up JavaScript any time soon, would be a difficult task. I think people like to point out the flaws of JavaScript because there isn't really a major alternative, it is the de facto web language.

zzzcpan|6 years ago

> what they believe to be technically inferior solutions

When a lot of programming language research is pseudo science, technical superiority of a programming language becomes almost impossible to judge from CS point of view and yet these are the backgrounds people judging programming languages usually have. So here we are, not even able to have proper discussions concerning programming languages. Maybe things will change in the future now that actual empirical evidence can be gathered from open source code and bug trackers, but so far it doesn't seem to have a significant impact.

traderjane|6 years ago

The problem is partly "political" in the sense of negotiating industry power (rather than state, community, or interpersonal power), and complaining is part of political communication and deliberation. Consensus is not instant or free.

cm2187|6 years ago

Isn't the solution on its way with wasm, ie. the ability to run pretty much any other language in the browser at high performance?

vfc1|6 years ago

I've read it, just another piece with zero substance. So what's the author's point, why is Javascript bad according to him?

- because there is no standard library and a lot of things are left to userland

- because Axios error handling is less than ideal

- because bugs sit long time in public repos unanswered

- because some of the language unusual expression parsing quirk, that I've yet to find in a real program

- because projects like Webpack have tons of funding via open collective, while other important libraries are done on a voluntary basis

I couldn't have put together a more random set of unrelated and largely irrelevant complaints if I tried to.

notus|6 years ago

Typical disconnected comments from the author about JS as usual. Why would they focus on axios error handling and not fetch? Even dredging up some left pad....

People complain about standard libraries in languages that have them. Damned if you do, damned if you don't. Let's just chalk it up to a different way of doing things. I personally don't mind leveraging NPM for packages I need. I make use of utility libraries like lodash-fp or ramda to provide the functionality I want.

Bugs actually have a pretty decent amount of resolution for popular JS libraries. I think this is true for all languages though. Popular libraries get worked on, unpopular ones don't. Cherry picking bugs that the author thinks should be easy to fix isn't doing any service to anyone. Everyone who has worked on a product intended for longevity knows there are a ton of easy bugs that never get fixed because of something called.... priorities.

randomdudeonhn|6 years ago

I've tried to explain my point and provide some examples of how the problem manifests in the ecosystem of the language. While my writing skills may need work, I would not call the post random.

reimertz|6 years ago

I tried C, C++ and Java at university before I trying JavaScript. For me JS was the language that made programming fun and exciting.

Your code didn't have to compile, you just write code and debug it in real time and it ran on both my phone and my computer. For me, the web console felt like magic, playing around with all the quirky APIs the browser offered.

Later, I realized I could buy a domain and then have my js available to anyone who went to my website. It felt like the sky was the limit.

Then we got into hardware, and I realized that I could write js using Johnny5 that ran on my Arduino. Without knowing it, I used Node.JS and that opened the ability to start writing simple backends.

Eventually, I realized my code looked quite bad, nesting callbacks like crazy (which I later learnt was called callback-hell), but at the time, Promises became a thing and without knowing it, I kind of grasped the concept of async functions.

I moved on to creating mobile apps using Phonegap; it was really cool and worked well until you realized that there are slow Android phones to and you had to think about performance.

That lead me to try React Native and all of a sudden I had apps running native UI on both Android and iOS. It also introduced me to Objective-C, Swift and how to deploy native apps.

What I am trying to convey here is that Javascript was fun and exciting early on, I could stack knowledge quite easily and pivot into multiple roles with very low threshold.

Sure, there are many quirks with Javascript but in the end, I'd say it's a part of the language and what makes it fun. Just look at React Hooks. :)

martpie|6 years ago

Rambling, rambling, rambling. There are so many wrong things in this post that I don't know where to start, from the design controversy to packages syntax without talking about the package manager. But other comments will debunk them better than me.

That said, a lot of people say JavaScript is bad. And yet this language is one of the most popular one in the world.

And people never ask themselves: "oh, maybe there is something I did not understand about the language/ecosystem".

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

Peace.

ps: also, it's not the tools that matter, but what you build.

fnordsensei|6 years ago

I see that as literally the main point that the author sets out to argue: popularity does not equal quality.

I don't think it's a very controversial idea that JS is popular due to its monopoly status rather than its qualities (whatever we argue them to be).

I find it hard to imagine that JS would have ever been very popular on the backend or on smartphones if it wasn't for the monopoly of the frontend. The fact is, today you can cover many bases with this one language. This is great for businesses where the primary concern is how quickly you can get a new person to sit in someone's seat, so this opens up a lot of jobs. A lot of jobs means a lot of incentive to learn the language, closing the loop.

In short, for many actors on the market, there are many reasons to use JS without having to like JS, or even care about its qualities as a language.

I'm not sure why it's hard to swallow that JS (the cultural phenomenon) has qualities that aren't inherited from JS (the artifact).

papermachete|6 years ago

I personally hate when developers make fisher price websites with javascript for GUI, when all or almost all of it can be replaced with HTML and some CSS. You know, things my browser can execute with highly optimised machine code.

stefano|6 years ago

> That said, a lot of people say JavaScript is bad. And yet this language is one of the most popular one in the world.

The post is about the fact that just because something is popular, it doesn't necessarily mean it's good. The fact that JavaScript is popular cannot be used as proof that it's a good technology. It had a monopoly of the browser market for decades. If Netscape put COBOL there, everyone would be programming in COBOL today.

randomdudeonhn|6 years ago

Some people never ask themselves "have I actually read what I am criticising?".

randomdudeonhn|6 years ago

> it's not the tools that matter, but what you build. Given this logic we all should be writing in Algol.

bluewalt|6 years ago

After reading almost all comments, all of this make me think that your positions on the debate are based on psychological characters. Some people are idealists: as Javascript is in some state, but could have been a lot better if history had been different, they CAN'T be happy, they won't. They need to find THE right tool before working with it (I'm an idealist). Then, you have other kind of people which are more adaptative: they tend to accept the situation "as is", and try to withdraw the maximum of benefits of the language. It's easier for them do deal with the issues because they accepted the situation initially. BTW, I think those people are more happy in their daily life. And last, the negationists: they refuse to accept the truth. Those people rely on wrong things (like trends) to evaluate the quality of the language. For them, if JS is used so much, it MUST be good, even if they're not sure why. They believe world auto-regulate itself with natural selection (like ultraliberal people). Plus, if they start to use it, they don't want to hear it's bad because it would question their choice, and by extension, their intelligence.

johnisgood|6 years ago

Why was this submission flagged? I really would like to have an explanation. One may disagree with it, it may be controversial, but does this really require it to be flagged? After all, it is getting upvotes! I am not exactly new here but I have no idea what it means for a submission to be flagged or why it should be flagged vs. just not voting it up.

runn1ng|6 years ago

We need to separate two things.

One is that JavaScript is bad. It’s true, but strongly typed languages built on top of JS improve it immensely. Most people today use TypeScript, I used to use Flowtype but the history went the other way, oh well. So that part is being fixed.

The other part is the package management, and the ecosystem, and that’s almost independent on JavaScript the language. And well, the situation there sucks so much that I needed to escape to backend world, since I don’t want to deal with broken webpack plugins anymore.

Don’t get me wrong, it’s also broken in python and golang (my current languages), but people at least ADMIT it’s a problem, and in golang folks try to fix the vendor/ mess with modules. (Python... ugh.)

I wish the npm mess was getting better, but while yarn at least solved some sub-problem, the whole thing doesn’t get better. Back to golang I go, I feel happy here.

(Well unless I have to copy paste Apply for the 30th time.)

hankstenberg|6 years ago

Javascript is extremely flexible and unopnionated. It is very easy to write horrible code in it and very hard to write good code. The same goes for assembler. But Javascript is still a nice language to compile to, e.g. from Clojurescript (which is a fantastic and very opinionated language). It can run virtually anywhere and modern Javascript engines start up very fast, making them ideal for stuff like AWS lambda and even CLI tools.

bluewalt|6 years ago

To me, the fact we need another language to compile to it, is just another proof the language is broken

wolframhempel|6 years ago

I'd argue that JavaScript was - coincidentally - a lean design. Meaning: minimal MVP, go to market early, grow with consumer demand. Sure, this results in a less intellectually pure programming language, but instead in a rugged workhorse that remains widely accessible. Not sure that's a bad thing.

tekkk|6 years ago

If there's something developers like to complain about it is JavaScript and JIRA among other things...

I agree with the overall thesis but do not like the presentation. The world is run by hacks one uglier than the other. Javascript, despite its faults, had some good parts that let it grow to the size it currently is. Yet I do not know do we need more preaching about that JS is outdated and we should move on, I at least have already shifted my focus to a new more productive language (granted TS isn't that big of a jump). JS to me is legacy, and I am expecting it to be slowly phased-out as soon as better alternatives become available in the form of WASM or by compiling to JS.

But JS had a good run and contrary to a lot of folks who keep complaining about it, I appreciate what it gave us in the form of simple package-manager (npm was revolutionary at the time, and yes it has its faults). All the amazing frameworks and libraries people have put time and thought into (React, Vue etc) which may have not always been the most bug-free, but I see the proliferation of libraries as a good thing - JS ecosystem has always been constantly changing. When the barrier for creating libraries has become so low, it accelerates the adoption and propagation of fantastic new tools that constantly evolve. Sure, I would like to have also the reliability of the more mature ecosystems but what can you do?

I think I have dabbled so long in JS that it doesn't bother me that much anymore. I mean, who can keep questioning why houses look like they do or why cars drive in certain side every day? It just is what it is. I'm busy building stuff so it feels like waste of my time to keep ruminating on these things. And well, I do mainly TS now so it's not that bad.

vnchr|6 years ago

English is bad. JavaScript is bad. US customary measurement system is bad.

And you still have to deal with them all. This site is famously written in something cool that’s not JS (EDIT: I thought wrongly that it was Perl). Oh, what's that `hn.js` in the Sources? And you're back to using JavaScript.

JavaScript may be bad, but you need us JS devs to do what we do. We are vital to the advancement of civilization as long as web browsers relying on JS are an essential platform for human communication.

I recently started writing in Golang--it's great! Really enjoyable. The ecosystem is making me act like a better developer. Golang Is Good.

But JavaScript, that's my job. JavaScript isn't going away. We are making it better. We are making better things with it. So "JavaScript Is Bad" all you want. You're still reliant upon it. It's still essential. It's still going to be the first programming language of many developers, especially the self-taught. JavaScript is eating the world.

JavaScript Is Bad. And I'm a bad, bad man. If you can't beat 'em, join 'em.

lidHanteyk|6 years ago

NoScript works fine on HN. Works fine on most of the Web, really; you'd be surprised.

To dig a little into your mindset, it sounds like you enjoy being needed and having an important part to play. But you've limited yourself by tying yourself to JS and not embracing a wider understanding of computer science.

JS is a portion of my salaried work as well. But that doesn't make it good. Plenty of salaried work is bad. It's up to us as ethical computer scientists to decide to avoid bad work, including deciding to avoid JS.

At the end of the day, JS still doesn't even have integers. It's just as harmful to you as BASIC was to Dijkstra's students, and the damage done is so extensive that you're unable to notice how much you've been hurt.

The only saving grace is that the ECMAScript steering committee has been infiltrated by capability-security folk and is slowly becoming a capability-aware language. You can't stop this, and you will be converted.

boomlinde|6 years ago

What is it that you are working on that is vital to the advancement of civilization?

swalladge|6 years ago

The sad thing is that we all chose to be content with a prototype built in 10 days rather than being patient and taking the time to develop a carefully designed solution. It's only now that it's something we are forced to use and put up with because the work required to develop and switch to something better (or even drop backwards compatibility to actually make javascript better) would be phenomenal.

arethuza|6 years ago

"This site is famously written in Perl."

I think HN is actually written in ARC, which is a dialect of Lisp?

atemerev|6 years ago

Javascript is fine. It has first-class functions, a minimal but functional metaobject protocol, lambdas, etc. It is also fast and has familiar syntax to work with. There are many worse programming languages out there. I admire the “everything that is popular is wrong” maxim (it is quite popular), but blaming JS as some sort of ultimate evil is somewhat unsubstantiated.

randomdudeonhn|6 years ago

Boeing 737 MAX is fine. It has good hydraulics, state of the art breaks and a fine wing shape. It also falls from the sky but don't let the naysayers discourage you.

jbverschoor|6 years ago

It is exactly because it's so bad (forgiving) and availability (browser) it became popular. Just like many other tech.

tyingq|6 years ago

"how our pluralistic ignorance allowed toy language to first become de-facto language in the browser"

I don't know that Eich had lots of obvious choices. I imagine Lua was still pretty obscure in 95. So the choices were probably tcl and lisp if he wanted something lightweight and dynamically typed.

BrendanEich|6 years ago

See https://news.ycombinator.com/item?id=1905155. Anyone who looks at either JS or Lua today or even within the last ten years is not being realistic about what was possible in 1995.

Anyway, "Make It Look Like Java" and the time crunch overrode any thought of using some unsafe/unportable/freely-evolving language implementation.

In other news, HTML is bad, CSS too.

notyourday|6 years ago

Lua makes JS look positively divine.

t0astbread|6 years ago

This is a classic on Hacker News: Some smug elitist rambling about whatever's currently popular by being super nitpicky because it's not their preferred solution.

How about writing a blog post about what you would use instead of JavaScript and why it's good instead of this? That might even help someone.

cm2187|6 years ago

The word "popular" can mean widely used or widely liked. I think popular in the case of javascript is more the former but people often imply the latter. By usage, death and taxes are popular too!

randomdudeonhn|6 years ago

Unfortunately, I keep hearing from many developers that JS is popular and therefore cannot be "that bad". Which it is, in spades.

harimau777|6 years ago

I don't disagree with the article. However, I'd also argue that JavaScript is good in that it is the best option for functional programming which has an approachable syntax and jobs available.

I guess what I'm saying is that I'd love to be able to start using a better language that allowed me do functional programming on the job. However, I'd rather keep using JavaScript than use a better language that didn't allow me to use functional programming.

dahfizz|6 years ago

Have you ever used... A functional language? JavaScript has lambdas and functions, but I would hardly call it functional. Having types and immutability and pattern matching are pretty important. Being able to run multithreaded would also be very nice.

swalladge|6 years ago

Let's replace javascript with ecmascript6 here. The recent ecmascript specs are really nice for functional programming. Javascript in all its backwards compatible glory doesn't have much niceness in the way of FP.

therealmarv|6 years ago

There was never ever a design board for the Internet we know today. Actually when looking back many things look like ducktapes on ducktapes on the Internet and we can be happy that a whole industry takes care on it so that it will keep working reliable. I also think that Webpack and OpenSSL are two completely different things (it's like comparing apples with oranges)

Nowadays you either deal with JavaScript one way or the other or stay away from the browser entirely. Deal with it.

Btw. I also think that JavaScript has many flaws which are based on history... but from a practical point of view I don't have time to reinvent the Internet or time get too much bothered by it ;)

Deukhoofd|6 years ago

Where do you get the info that OpenSSL only gets 100k $ a year? I see 2 exceptional sponsors, and 5 Platinum sponsors. That comes down to at least 400k $ a year. This is not including other donations they receive.

anticristi|6 years ago

I would very much love to read a prequel article that defines "bad". I define a "good" programming language and framework as having as many of the following properties:

* It can quickly solve a problem, e.g., build a webapp that uploads cat pictures.

* It is here to stay, i.e., my investment in using and learning that tool won't be subject to hyperinflation.

* It has a good enough base, i.e., I can quickly recruit someone to scale-up my problem solving.

According to my definition JS is good, or, at the very least, is good in 2019.

johnisgood|6 years ago

It really depends on the type of problem. In many cases, C was really great to use to quickly solve a problem. It is here to stay, and has a good enough base.

johnmarcus|6 years ago

So build a better browser with a better language and devs can adopt it. Put up or shut up. You know what's almost as old and quickly written as JS? Complaints about JS.

1f97|6 years ago

can anyone tell me why he says that the axios snippet is wrong?

grenoire|6 years ago

You catch an error to proceed with the expected behaviour, for one.

mdemare|6 years ago

Why use anonymous functions for control flow? Nearly any other language would either return an error or throw an exception.

pluma|6 years ago

Presumably because a rEaL pRoGrAmMiNg LaNgUaGe would have used different exception types to provide the same levels of distinction which still results in basically the same if/else-if/else (or try/catch/catch) structure but "more civilised".

Or because he thinks web apps don't care about whether the server couldn't be reached and whether the server rejected a request. Your guess is as good as mine.

tasqyn|6 years ago

because nested ifs, I think.

lpellegr|6 years ago

but TypeScript is great, so JavaScript is not so bad?

codegladiator|6 years ago

Hammers are Bad. Look at all the modern tools which are build with sophistication, and look at hammers, and everyone is using hammers.

ulisesrmzroche|6 years ago

Citing the Wat talk in 2019? That’s about as tacky as JNCO jeans

So the bazaar always wins, hmm

willbw|6 years ago

This piece reads like the author didn't even bother to read over it once before posting it. All over the place. Are there no standards here for things to be upvoted? This is pretty bad writing.

swalladge|6 years ago

"javascript is bad" == upvotes because it resonates with so many people

LargoLasskhyfv|6 years ago

It's just the largest, not the greatest, job creation scheme since the building of the egyptian pyramids.

So churn we all...

Hail the Powers of Babylon!