by mratzloff · 13y ago · 0 comments
For that audience, they are given a language with optional static typing (most don't want it) and an Eclipse-based editor (most don't want it).
By way of contrast, consider Go. Go is (in my opinion) an extremely successful successor to C, in terms of its design. It fixes a handful of problems with C (strings, and I would argue pointer arithmetic), and modernizes and streamlines it. The interface system is fantastic. In terms of its design, I have nothing but good things to say about Go.
Dart does not seem to improve on JavaScript in a compelling way. It adds optional static typing, and as far as I can tell, nothing else.
Is it any surprise that Dart has failed to take off?
You don't need to write Dart in the Dart Editor if you don't want the IDE experience. I happily write Dart in Sublime, and Dart has command-line tools that I can use to validate the code that I write.
But web developers, who are the primary producers of JavaScript, will happily stick with Node.js, CoffeeScript, or plain JavaScript.
If web developers are happy with the tools they have, then that's just fine. The Dart team isn't trying to replace JavaScript, but instead provide another option for web development. What I think the Dart team is finding is that there are a lot of people that are having trouble with putting together all the pieces just to build a web app. This is especially true if you are new to the web platform, and you're familiar with the development from other places. Dart provides a very consistent platform that you can build web applications with, and you don't need to worry about jumping through all the hoops that normal web development requires.
By way of contrast, consider Go. Go is (in my opinion) an extremely successful successor to C, in terms of its design. It fixes a handful of problems with C (strings, and I would argue pointer arithmetic), and modernizes and streamlines it. The interface system is fantastic. In terms of its design, I have nothing but good things to say about Go.
In a way, this is how I see Dart too (though Dart is a much newer platform, not yet out of beta). Dart aims to fix a handful of problems with JavaScript (like better scoping semantics, a built-in module system, better toolability and static analysis tools, etc.), and then also takes the existing browser APIs and modernizes and streamlines them (for example, all of the core browser APIs use a consistent Future-based API for asynchronous values, which cleans up a lot of messy code that you'd ordinarily see in JavaScript web application code).
Is it any surprise that Dart has failed to take off?
It's not at 1.0 yet. I still think there is plenty of room for improvement, and plenty of time for adoption.
There's definitely room for both polish and adoption.
This is the same line argument made with regards to Java too.
But the fact of the matter is, these language bring in so complexity with their whole ecosystem. Working without an IDE isn't even worth that torture.
I've written Java in plaintext editors before, and that is truly terrible. Dart is nowhere near that verbose. Dart's imports feel pretty lightweight (rather Python-esque) and the fact that the language has top-level functions and variables means that you're not always trying to juggle a bunch of classes and objects and interfaces when you don't need to. In fact, Dart's style guide explicitly recommends that you don't put things in wrapper objects just because you can. http://www.dartlang.org/articles/style-guide/
I really don't think that Dart brings in any more complexity than you'd have in a JavaScript application. I actually think it's a lot easier to hold a Dart application in your head because all the APIs have a consistent interface. With JavaScript, you often have a bunch of different libraries and you have to remember how each of them behaves.
How do you use your JavaScript libraries today? Do you have evrything memorized?
Dart is an ambitious attempt at simplyfing web development, reducing complexity and improving productivity which:
- Provides a familiar language with clean semantics and low ceremony
- Provides the fastest dev iteration times (there's no compile step,
just edit + run in Dart VM/Dartium)
- Provides ~10x faster start-up times with snapshots (Dart VM)
- Provides faster run-time performance, that's predictable and can take
advantage of real integers and SIMD instructions (VM Only)
- Provides a unified object model so all classes from all libraries can interoperate
- Providing a rich, well-defined, consistent API, real collections, removing JS WATs,
smoothing over browser quirks
- Provides a unified and composable IO model: Futures and Streams (repeating events)
- Provides a new powerful way to develop client apps with Web UI (Dart WebComponents)
offering unprecedented levels of encapsulation and reusability
- Provides optimal dev and deployment options, you never have to worry about choosing
the smallest libs as tree-shaking ensures only code used is compiled and minified
- Providing "full-stack" dev environment, e.g. same language on client and server
There are many initiatives ongoing to improve web development IMO Dart is the most radical and has the most potential to provide a productive web development environment in the visible future. I hope it extends further than that and is offered as a language choice on Android (which will make me switch to Android dev).It's very disappointing that the first serious attempt to replace JS after almost 20 years is merely just another Java-syntax-like JIT-compiled single-threaded dynamically-typed garbage-collected language with global, shared mutable state. It's fundamentally the same language merely with some pet peeves removed and a bit of sugar on top. It's a waste of opportunity.
Every other attempt adds more layers and complexity and additional build times to web development, only Dart brings a clean re-write.
AS3, C#, Java, and JavaScript developers. That's why they went with C-like syntax. It's familiar to most people.
>But web developers, who are the primary producers of JavaScript, will happily stick with Node.js, CoffeeScript, or plain JavaScript.
I'm writing JavaScript for a few years now. I'm really tired of it. It scales very poorly and there is zero tooling. For example, JSLint is mostly about formatting and conventions, because it got very little information to work with.
Also, if you want to take care of dependencies in JavaScript, you'll need boilerplate code (several flavors exist). If you want to document your code, you'll need lengthy doc comments (several flavors exist).
Finally, with JavaScript you're always discouraged to write extensive libraries, because everything you don't use is dead weight.
With Dart, you don't have any of those problems. It scales, there is proper tooling, you can use `import` and put stuff into packages, basic documentation is already done by adding some type annotations, and unused code is also removed.
Additionally, it's a lot easier to learn than JavaScript, because the language is less quirky.
>Dart does not seem to improve on JavaScript in a compelling way. It adds optional static typing, and as far as I can tell, nothing else.
Classes/inheritance, mixins, implicit getters/setters, implicit interfaces, import, lambda expressions, proper lexical scoping, a lexically scoped `this`, operator overloading, actor-like concurrency (isolates), SIMD, faster startup, better performance, const/final, factory constructors, optional positioned/named arguments... and good tooling.
Seen that "WAT" talk? None of that.
Dart is drastically better than JavaScript.
var count = 0;
for (var i = 0; i < arr.length; i++) {
if (some_func(i)) {
count++;
}
}
I have no idea why JSLint would tell me that I should move the definition of "i" to the top of the function (am I supposed to pretend I'm writing ANSI C for obsolete compilers?) and its insistence that "++" is evil in both uses above is equally ridiculous.I love static analysis, I like tools that automatically format source code (indent, go fmt, emacs), but JSLint is just annoying.
var foo = "The id number is: " + ++this.id + ".";
a Minifier may make that like
var foo="The id number is: "+++this.id+".";
which is a syntax error. Now of course you should be using a minifier that wouldn't be so stupid but it happened in our staging environment because some former employee used a very basic, yet aggressive minifier in the build process from Staging to Live.
JSLint gives you an option to turn it off though, plusplus:false. Same with the variable hoisting warning others have explained.
Even when one understands the reasoning behind why a tool like JSLint suggests what it does, this doesn't change the fact that dietrichepp's observations are correct. JavaScript's scoping and variable hoisting are unnecessarily broken, leading to convoluted coding practices that wouldn't really be necessary if JavaScript itself wasn't so broken.
You realize Dart literally has broken generics? That the team thought covariant mutable collections was a good thing?
Anyhow, JavaScript doesn't have any kind of generics or types. Do you really prefer that?
I remember that Dijkstra had some pretty good article about it.
I know there is a stream of Java / C# / C++ programmers that desire a Java-esque, improved GWT experience and loathe Javascript. But I see Dart more as a refined/upgraded Javascript -- some additional language/toolset features like Objective-C or C++ do for C.
Advantages of Dart over Node.js or CoffeeScript or plain Javascript?
1. "Batteries included" -- instead of reliance upon assortment of modules, OO system built in, better DOM utilities than jQuery (query returns a first class object), functional like Javascript sans the function keyword).
2. So nice that you can split a project across a whole bunch of code files, yet it will condense and minify into one efficient javascript file. Yes, there are tools with all the various Javascript frameworks to accomplish this, but then you're reliant upon of hierarchical library dependencies that sometimes can be brittle.
3. Can run server side just as Node.js with a powerful VM, without the need (though certainly possible and optional) to install a plethora of other libraries.
I think it hasn't taken off because up until recent months, the language and library has not been stable enough for production development -- libraries have changed a lot and most of the code in all of the Dart books published to date will not run at all now (though the Dart SDK comes with a tool that can help migrating code).
There are still some sore spots I hope get addressed -- primarily, on server side, need for built-in DB libraries and on client side, JSONP/CORS that is as easy as jQuery makes it. At least in my XP.
All of this is courtesy of the Closure Compiler, which uses optional static typing.
Sometimes people chose to use a language for a new project because of existing labor pool, that is, who they can find to work on the project and what their preferences are. Sometimes it's because they want to use an existing codebase. Sometimes, people chose a new language because they are in an experimental mood and want to try something new.
If Larry Page were to say "all future apps have to be written in Dart", it would be damaging to company morale and culture, not because there's something wrong with Dart, but because people chafe being forced to make technical or personal decisions like that.
Google can no more force you to use Dart than they can force you to use CoffeeScript or GWT, I think people need to chill out and stop aggressing against anything that threatens Javascript hegemony. I mean, sheesh, people are even rebelling against some of the changes in ES6 which fix some of the most egregious problems that drive people to create transpiled languages.
Also, I meant it will be interesting if no team chooses to use Dart on the client, but it gains interest on the server. Presumably teams go with what makes sense and that will be interesting to watch.
> I think people need to chill out and stop aggressing against anything that threatens Javascript hegemony
They have over the last 6 months as more and more people are realizing that pure JavaScript is not entirely suitable for large scale applications that are becoming more common. As someone said, the efforts to make it so are 'heroic,' but obviously the hard way to do things, like choosing to write a large application in assembly language. Having done that once, I would never do it again, and would take someone who said this was best less seriously.
I tried DART and did multiplayer online game http://shipsonline.org/ as my first "hello world" without any external code. Epic win for myself. It has more than static typing, please try write simple app and you will see. Eventualy it became stable and then became mainstream popular i hope.
There's also a plugin for Intellij IDEA[1], which is a great web (and other use) IDE.
The thing isn't static typing- it's static analysis. The ability to specify contracts in your code and have something validate your code. This is the same thing TypeScript and Closure try to address, but Dart is trying to tackle the issue at its core, with performance to boot.
Dart will never take off if the other vendors don't offer VM support on their browsers. Almost every language has JavaScript transpilers and as a Chrome only solution it won't work.
Both are compelling advantages of Dart.
"It adds optional static typing, and as far as I can tell, nothing else."
And as far as I can tell you don't have a clue of what you're talking about.
I received a lot of thoughtful, intelligent responses to my post, including many that disagreed. Unfortunately, yours was not one of them.