top | item 8308255

This will make some people mad (JS/Dart)

79 points| wyc | 11 years ago |boustrophedon.github.io | reply

discuss

order
[+] dang|11 years ago|reply
This post was killed by user flags.
[+] aikah|11 years ago|reply
TLDR: author in the shower ,makes no point at all,there is no TLDR.

I'm no fan of Dart,but competition is good. Choice is good. If you dont like Dart dont use it.

[+] melling|11 years ago|reply
No, the obvious point was there is some difficult technology X that people have learned to deal with and have actually grown to like, and there is a new technology Y that is somewhat better but perhaps it doesn't offer enough to convince the fans if X to use it. We could be talking about Java vs C++ 20 years ago.

Some people are wired to want the new thing while others will say "the old thing is good enough for me." Now it's just a matter of waiting to see if the new thing has enough new features to supplant the old thing. It took Java quite a few versions to gain traction. Remember how it was known for being "slow" for years?

[+] untothebreach|11 years ago|reply
pretty sure the author shares your view. Author spent 99% of the article bashing vanilla javascript, and the last paragraph praising dart.
[+] xsace|11 years ago|reply
I read some good things on HN, I mean - really good things -

And then this, it's not even the level of what you can hear at the coffee machine.

OP please don't metaphor in the shower. You're wasting the planet's water.

[+] rtpg|11 years ago|reply
I'm sorry but Dart just doesn't have that many convincing features. Having type checking is a good thing and I like it, but there also needs to be things that allow me to write more concise and clear code (and allowing certain patterns to be easily expressed)

The patterns that Dart facilitate are just as easy to describe in JS.

[+] _greim_|11 years ago|reply
Dart's operator overloading alone makes it easier to write clear and concise code than in JS, e.g. for map and list types.

    // dart
    var listA = listB + listC;

    // js
    var listA = listB.concat(listC);
That's just the tip of the iceburg. Overriding the [] accessor for custom list types opens up whole worlds of possibilities.
[+] rdtsc|11 years ago|reply
> but there also needs to be things that allow me to write more concise and clear code

So what are some examples of those things that would helper you write more concise code?

[+] dubcanada|11 years ago|reply
What are convincing features? I'm not sure you've look at Dart, but there is a lot more then type checking.
[+] pornel|11 years ago|reply
That's a really weak and biased analogy… but going with it:

An entire thriving city has been built around the playground-over-minefield, and a fancy 6th set attractions is being built as we speak. It's right next to your door.

The nifty clean Dart-playground is still alone in a middle of a desert, waiting for a city to be built around it (and it's accessible via a tunnel dug from the middle of the minefield, if you like to get there quicker).

[+] kaonashi|11 years ago|reply
The thing for me is, I'd much rather use clojurescript if I'm going to use a language that doesn't compile ~1:1 to javascript.
[+] calinet6|11 years ago|reply
Guys, JavaScript just isn't that bad.
[+] danbruc|11 years ago|reply
No, it is even worse, PHP league bad. JavaScript was never intended for building complex applications. The same goes for HTML and CSS; the intention was to layout documents, not to build user interfaces.

I fully acknowledge that this stack is the best we have when it comes to web applications. I fully acknowledge that it might take ages or even forever to get a better alternative than sweeping the ugliness under the rug and compiling from more sane platforms. But being the best solution available does not make it a good solution.

We once build a small cabin in the mountains in the '90. Now we are running a hotel with a thousand rooms in and on top of that cabin.

[+] tomp|11 years ago|reply
> They build this nice big platform above the minefield, so you can't even step on it unless you really want to.

Except that Dart isn't type safe. And e.g. if statements treat most values as false. Plenty of mines still there.

[+] mythz|11 years ago|reply
What land mines? Only `true` is true in Dart, everything else is false.
[+] wprl|11 years ago|reply
Really, coding in JavaScript is hardly worse than most other languages.
[+] wtbob|11 years ago|reply
> Really, coding in JavaScript is hardly worse than most other languages.

See, that's the really sad thing about JavaScript: it's a Blub.

In addition to JavaScript, I've written C, Python, Ruby, Perl, Go, C++, Java, Common Lisp, Scheme, HyperTalk, Visual Basic, Lua and shell (I'm probably forgetting something). I've played with Erlang and Haskell. Every one of those is better than JavaScript. Most are much better than JavaScript.

What are my issues?

Well, there's the whole hasOwnProperty hack when iterating over an object used as a hash table. Then there's the default variable scoping. Then there's == vs. ===. The default fallthrough in switch. The lack of integers. The goofiness of details of the object mode (I'm not objecting to prototypal inheritance; I'm objecting to the myriad subtly different ways to do prototypal inheritance). The lack of a metaprogramming facility. The lack of a standard package or module facility and its consequent explosion into a myriad subtly-different systems.

And there's the callback hell of the browser runtime, but that's not necessarily JavaScript's fault.

When I write JavaScript, I feel like I'm back in the bad old days of C, where a single error will be undetectable by the compiler and result in simply a core dump, leaving my to single-step through my code looking for what went awry.

If it weren't The Language of the Web™ it'd be about as popular as Befunge.

[+] MrBuddyCasino|11 years ago|reply
So that means that either JS just isn't that bad, or most other languages just aren't that good.
[+] progx|11 years ago|reply
Great little article! I thought not on v8/dart when i read it, but on many other projects, the Stockholm Syndrome is everywhere.

If something new come up, you find many articles about "the new stuff" and how "fun" it is, how "easy" it is and how much it make your developer life "better".

Nothing against motivition & enthusiasm, but your metapher fits like a glove eye, in most cases it is the Stockholm Syndrome.

The most "new" things just solve things only "different".

[+] jlas|11 years ago|reply
The metaphor is incomplete, how do you reconcile the ubiquitous nature of JavaScript and the browser makers and ES6 and standards? It's just not that good. Sorry.
[+] javajosh|11 years ago|reply
It is useful to distinguish between first- and second-order concerns. The first-order concern for any application platform is ubiquity - market penetration. JavaScript wins that one, by a lot.

Literally every other concern, including language concerns, is second-order, negligible - and ultimately addressable.

[+] dlsym|11 years ago|reply
Yet another "booohooo JS language design sucks and I don't like it" post.

What year is this?

[+] cognivore|11 years ago|reply
Ha! The comments prove the article's point!

If you think JavaScript isn't too that bad, you need to think about whether you're truly a programmer at heart.

[+] rdtsc|11 years ago|reply
I think a lot of people using JS don't know any other languages. That is ok. But many have convinced themselves (and each other as a community) that this is RockStarTech(tm) and as good as it gets, as the article suggests.

If anyone/anything comes along and claims otherwise they will probably lash out against that. It would mean invalidating all the emotional investment (and real code and time investment) they put into it in the past.

[+] JakeKalstad|11 years ago|reply
If you think Javascript is really that bad, you need to reconsider whether you're truly a programmer at all.
[+] general_failure|11 years ago|reply
The truth is JavaScript is not bad. In fact, it's terribly good. It's one of those languages that people love to hate because they feel they sound very knowledgeable if they do so. And they haven't bothered learning the language as well.
[+] aboodman|11 years ago|reply
.bind(this)

-- a guy who built his career on JavaScript

[+] robmcm|11 years ago|reply
To extend the analogy, imagine there are lots of tour guides to the mine field, they make lots of money using it. Imagine their opinion of something that makes their knowledge of all the mine positions they have spent years learning obsolete...
[+] Bahamut|11 years ago|reply
Good luck convincing Apple to implement the Dart VM in Safari.

One complaint I have heard about Dart is that the dart2js library outputs unoptimized JS. This is unfortunately an issue if we will not see the Dart VM implemented natively by the browser vendors.

[+] manishsharan|11 years ago|reply
Are we now modding /r/showerthoughts upto HN front page ?
[+] danford|11 years ago|reply
Genuinely curious as somewhat of a novice, can any one give an example of how javascript is insecure in a way that is difficult to fix?
[+] pushedx|11 years ago|reply
Two of the worst things about JS that come to mind in terms of security:

Every number is in 64-bit floating point. So if you want to do any number-theory-based crypto (Elliptic Curve) or you have do deal with numbers bigger than (2^48) you either have to study IEEE 754 very carefully (and likely push to production a series of mistakes), or take the hit of using an integer math library that has worked out how to do proper integer math with the 48-bit mantissa of a 64-bit float.

Of course there are those who don't realize this at all, and try to do integer math in JS, or in the case of a beginning programmer (many students start with JS these days), they don't realize that 0.1 + 0.2 == 0.30000000000000004.

Every variable is global by default. The best way to hide data in JS is within a function closure. However, one forgotten var keyword, and your whole encapsulation model is trashed.