Live data from Hacker News

For modern development Javascript indeed is a shit language

live.julik.nl

11–20 of 243 posts

Re: For modern development Javascript indeed is a shit language

#11
Sadly I agree, you can just start with this:

    > [1,10,5,-15,-2,4].sort();
      [-15,-2,1,10,4,5]

And yes saying "oh but it is because it has weak types" doesn't excuse it, it is broken and that's that. Naming the brokeness with a label or showing why historically it is there, doesn't fix it.

On the other hand they do have nice closure support, I do like some of that. But in large, the language makes me angry every time I have to use it.

Someone mentioned Dart, I am hopeful for that. But who knows how long till dartvm is embedded in Chrome. For now dart.js and source maps might help.

There is a bit more palatable Coffeescript. But it only puts some band-aids over JS's brokenness.

Also agree with callback hell. It is funny people extol is at the next big thing -- whoo, asynchronous calls! You can callback in your callback while you callback. No, no, no. That is a horrible way to handle large concurrency problems! (Good for quick one page examples though!). Async and friends help. But why the heck do I need to stick a callback in the middle of my logic if all I need to do is make a request to the database or another GET request?

The only sane way I know how to best handle concurrency is using a language with support of goroutines/isolates/tasks or even threads and queues. Even deferreds are just sugar on top of callbacks. We all know how Python's Twisted has taken over the world, right? Oh wait, it hasn't. Calling them Futures or Tulips or whatever doesn't fix the underlying problem.

> I can understand that some people wanted to escape the MRI infrastructure by going Node, because - you know - learning Japanese is hard.

Granted node is fast. (And according to its author scales linearly across CPU cores, sorry couldn't resist the mandatory jab at that). Ok it doesn't really scale across cores and it will block everything if you do a for loop in the middle of your logic. But it is really fast, amazingly so. And that is like crack. It gets people hooked.

EDIT: JS has weak types not just dynamic, one can have dynamic and strong types for example, like Python ( https://en.wikipedia.org/wiki/Weak_typing ). Thanks makslinn.

Re: For modern development Javascript indeed is a shit language

#14
post #7

Personally, I disagree. I find JavaScript to be the most "write-able" language, and switching to Node + frontend JS as my main language (I've done Python, Ruby, PHP, Java and C++ as jobs) has been the best thing I've done in a long time. Express and Angular are amazing. Sure, it has a bunch of quirks. Sure, it's not good for everything (I do mostly relatively simple CRUD apps). Sure, in the browser, it gets slow when…

How do you handle Javascript ignoring wrong numbers of function arguments? Do you use a linter to catch this sort of thing? This part of Javascript sounds the most absolutely insane to me: Silencing an error like that is catastrophic.

It's just never been a problem for me, I guess? I know how it works in JS, so I either ignore it or use it to my advantage (the JS equivalent of overloading). You seem to come from a more strongly-typed background, but I've never once found the way JS handles it to be "catastrophic".

Re: For modern development Javascript indeed is a shit language

#15
"JS has callable attributes, Hobjects are unusable for stable keys...object does not carry any type information, Null everywhere, since ojects are hashes"

I find most of the problems listed are related with dynamic type system of JS. These all can be solved most easily by a statically typed language.

Therefore the debate mostly is between static vs dynamic typing.

Re: For modern development Javascript indeed is a shit language

#16
post #2

Is Dart an alternative for those problems? Edit: I mean stuff like "callback hell", does it allow me to programm normally and still avoid blocking the loop?

If you're doing frontend dev, then you must use Javascript or a language which compiles to Javascript. I believe Dart currently has a mostly functional tool to compile Dart code to Javascript.

As for callback hell, Dart has "Futures" which are basically Promises. If you like Promises, you could use Dart...or one of the many excellent Promise libraries for Javascript; the syntax is almost identical.

(The linked article savages Promises for no obvious reason. I happen to like the syntax. In any case, Dart uses the same syntax, so if you buy the articles criticisms, Dart is no panacea.)

Re: For modern development Javascript indeed is a shit language

#17

Personally, I disagree. I find JavaScript to be the most "write-able" language, and switching to Node + frontend JS as my main language (I've done Python, Ruby, PHP, Java and C++ as jobs) has been the best thing I've done in a long time. Express and Angular are amazing. Sure, it has a bunch of quirks. Sure, it's not good for everything (I do mostly relatively simple CRUD apps). Sure, in the browser, it gets slow when…

I see this all the time. JS is slow because of the dom. No. JS is slow because JS is slow. Yes, I know V8 makes it faster than it used to be. Yes I know it is neck and neck for computation, but because of the way memory is handled it is slow for loading large dictionaries.

But I could forgive all of that.

JavaScript is not well designed for work in a team environment, nor is it well designed for Large Code Bases.

But I could forgive all of that.

All the best languages have a group of scientists that have chosen that language to be their defacto language. That is why we see Python, LISP, Fortran (yes still), MatLab, all living on long beyond the "trendy" languages.

JS only picked up steam because Flash died. Not because it was a great language. If it were a great language people would have started optimizing it 5 years ago. It isn't. So they didn't. The new optimizations are out of necessity. And because it lets front end pretend to be backend. That may sound snobby, and it is, but JS for backend is like writing in Visual Basic. These days you can do anything in it, it will be fast, but that doesn't make it the right choice.

Re: For modern development Javascript indeed is a shit language

#18
For modern development of what?

Then don't use Javascript.

I'm not sure I can really appreciate another rant about how one language, framework, pre–compiler, VM, etc is terrible and everyone should stop using it.

Javascript's popularity has emerged organically. Its not because it has the best design. Its because it can get the job done and is browser based–and now server-side too. The browser is the next OS, the ultimate VM, if you will.

If you just stop picking at it and appreciate it for what it is...it is f'ing awesome.

Re: For modern development Javascript indeed is a shit language

#20
post #7

Personally, I disagree. I find JavaScript to be the most "write-able" language, and switching to Node + frontend JS as my main language (I've done Python, Ruby, PHP, Java and C++ as jobs) has been the best thing I've done in a long time. Express and Angular are amazing. Sure, it has a bunch of quirks. Sure, it's not good for everything (I do mostly relatively simple CRUD apps). Sure, in the browser, it gets slow when…

How do you handle Javascript ignoring wrong numbers of function arguments? Do you use a linter to catch this sort of thing? This part of Javascript sounds the most absolutely insane to me: Silencing an error like that is catastrophic.

Is this so much of a problem that we need to re-design JS to handle it? Why not just avoid making this mistake in the first place by reading the code? Not to sound dismissive - but if you're making these kinds of mistakes regularly enough to irritate you, it's not the language that's at fault.

Javascript's squishiness is the thing I like the most about it. It's far from perfect, just like any other language out there - but it's fun.

Post reply on HN