开发者

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

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and开发者_StackOverflow possibly reopened, visit the help center for guidance. Closed 10 years ago.

I don't see the point of Dart in terms of the problem they are trying to solve.

I read that it was created due to short comings of JavaScript, however those short comings were not given.

Can someone explain the benefit of learning Dart rather than me learning Node.js?


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜