What is the benefit of the Dart language over JavaScript (Node.js) [closed] What is the benefit of the Dart language over JavaScript (Node.js) [closed] dart dart

What is the benefit of the Dart language over JavaScript (Node.js) [closed]


The main issue I see it as solving that of creating large, multi-developer applications.

In Javascript, I can write the perfectly valid code:

function x(y) { return y*y;      }document.write(x(3,4,5));

And this will execute fine, but it's blatantly an error.

Now separate the function definition and the function call by several developers and several months over a codebase of several thousand lines of code.

The original function x(y) could have originally been function x(y,z,a) but has since been refactored over time. This is where javascript fails for me, and this is what dart will help resolve.

Edit (May 2013) In addition to my answer above, which I believe still holds true, I think that the performance story is also getting pretty compelling. Lars Bak and Kasper Lund's talk from Google I/O provides some evidence.


The technical overview seems to summarize the difference quite well:

  • classes: while JavaScript is object oriented and it does not provide classes (at least in its latest incarnations), it is really a prototype-based language and not a class-based language. While that is not inherently worse, it is different from most major OO languages, which makes it harder to learn for most people.

  • (optional) static typing: You can't do static typing (as in: "checked by the compiler") in plain JavaScript. The advantages (and disadvantages) are well-known and have been widely discussed.

  • language support for libraries: "loading that file before this" is a very primitive way of implementing libraries and most modern languages have explicit support for libraries in some way.

That page also mentions tooling, but that's not an inherent difference between languages. Granted, a statically compiled and typed language is easier to write good tools for, but this is not a fundamental difference that can't be solved by programming.