JavaScript Is Bad
ror6ax.wordpress.com
ror6ax.wordpress.com
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.
The author of this specific article doesn't even seem to consider that there may be non-technical factors at play that cannot be fixed by coming up with (yet) a better language.
It's the same over and over again, unfortunately.
For another example, just go to Reddit's front page. It's the same trendy questions from young people a decade earlier as well.
You'll know an online community is on the path to dissolution when it can 'resolve' problems for good.
The same applies to HN: I'm sure my point has been made many times before, and will be made many times again here.
Frankly when you look at the number of megabytes downloaded by a typical web page, having a standard library stored on cdn shared between websites wouldn't be that big of a deal.
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.
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.
A decade long series of rants doesn't help at all.
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.
- 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.
There is always some library that is not that well designed that got more popular than it should, little response from certain Github repos, some less than ideal language feature that is there due to historical reasons, important code maintained on a voluntary basis.
Tell me an ecosystem that does not suffer from any of these problems, and I will show you a language that hardly no one uses (when compared to Javascript).
This stuff is inevitable, it comes with the years, due to backwards compatibility, stuff piles up over time. Javascript has resisted particularly well.
If you don't like Javascript, switch to Typescript for me it's the enterprise language of the future, for doing both backend and frontend development.
Your beef seems to be with a pile of convenience code added by some other projects.
True. I wouldn't say it is random. It was an interesting read. I do find it interesting that the title is "Javascript is Bad" as opposed to say "Here are some warts you can find in Javascript". My take is that it can't really be entirely bad. If it is then it doesn't really seem to matter. For various reasons (some probably down to chance) JS + HTML + CSS underpin the web in spite of their faults. What that suggests to me is that JS must have some properties that have enabled to dominate the web up to now. I wonder if in reality what matters most is the user experiences delivered to users and the value that derived by the individuals/companies that produce them. In addition the ease with which new devs can get started with the language seems like a big plus. With that mind, in some ways it's possibly irrelevant how nasty the code looks, how many iterations it took to weed out bugs due to the warts, packaging, etc
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.
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. :)
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.
"Rambling, rambling, rambling" part is especially unnecessary. How about quoting parts from the article instead and let us know what you think is wrong? As it is, I cannot imagine what I would reply to this "criticism", besides the fact that it incorrectly implies that popularity necessarily means quality.
Your post was rambling, in the sense that you make an assertion but then you complain about things not that related to your assertion. You never even define what you mean by bad. Then you use these reasons as justifications for why it’s “bad”:
A) Left pad exists. Basically, people in JS use packages instead of writing simple things themselves
B) A weird design decision with Axios, a third party library
C) A bug in Axios has been left open for a while
D) The built in map function is weird
E) Babel / Webpack get more money than OpenSSL
Only D is actually about the language itself, and E sort of is in a tertiary way but you never actually explain in any depth what your issue with Babel and Webpack getting funding is or what it means about JavaScript.
...this includes JS - every browser includes an engine that does exactly this, in fact.
It’s this lack of understanding of how the language and browsers function that makes these tired arguments particularly infuriating.
Of course not. Neither said by me, or your post I quoted. HTML and CSS aren’t any more “native apis” then the JS implementation of the w3c spec anyway either.
https://betterexplained.com/articles/logical-fallacy-popular...
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.
So, maybe it does not prevent SOME people, but it's about to prevent me.
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).
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.)
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.
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.
HN? No. https://en.wikipedia.org/wiki/Arc_(programming_language)
I think HN is actually written in ARC, which is a dialect of Lisp?
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.
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.
Mmm...just had a quick glance at the language reference. Couldn't see anything that would make it inferior to JS. Care to elaborate?
What do you mean you want to be able to get, like, keys of your object?! No one needs that! Write your own by iterating through the elements!
It's a name of a variable! Unless it is an identifier of a field. But we write it the same way. Here we even provide you a doc of this being a "got ya!" We documented it, so it is cool.
Don't even get me started on error stack using pcall() nonsense.
And if you really want to have a good time try figuring out how local variables scope interacts with each other... or with a goto.
I can go on and on and on.
LUA seems to practice answering "How many Microsoft Engineers does it take to change a lightbulb" question with the "None. Microsoft document darkness as the industry standard"
const a = []
const b = ''
const c = {}
c[a] = 'a'
c[b] = 'b'
console.log(c[a])
console.log(c[b])
But my point was more that if lua had been given the same amount of development it would probably have turned out as good, It hasn't, so comparing current day-lua with current day-js does not really work.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.
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.
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.
Immutability isn't enforced, but I have all the tools that I need to choose to handle data immutably.
I completely agree with you on types though. I don't know that much about TypeScript, but perhaps it would help?
You definitely have a point that functional programming would be much better in JS if these features were built in and/or enforced. However, the problem is: what's the alternative? Haskell/Clojure/Ocaml jobs aren't exactly common. And at least in terms of Haskell and Ocaml, I've found the syntax to be pretty arcane.
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 ;)
* 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.
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.
So the bazaar always wins, hmm
So churn we all...
Hail the Powers of Babylon!