Uninspiring isn’t always a bad thing
- October 11th, 2011
- Posted in Uncategorized
- By Michael Blake
- Write comment
Google Dart. You’ll be hearing a lot about it over the next few months, most of it almost certainly derisive.
I can’t argue, I find its syntax uninspiring. It is as straight laced and traditional a language as one could ever expect to see, and seeing that out of the creative geniuses at Google is somewhat surprising, but I also think it might be a situation where a development team carefully reasoned out -why- they were doing something.
Let’s consider the pervasiveness of modern Javascript.
Javascript is known, almost universally, as the language of web 2.0, a phrase that has been so abused that we’re all sick of hearing it. Javascript lets us provide any feel that we want to a web page. It lets us do webtops, applications, or dynamic interactive web pages. Javascript (or Ecmascript, if you’re old-school) has helped the web evolve rapidly.
Javascript was never intended for large scale application development. I’m not saying it can’t be made to fit, but its age is showing. There are attempts to move javascript into the future, but like HTML5, formalizing a javascript spec is a slow political process.
So Google, in what you could call an arrogant move (but I wouldn’t), decided to skip ahead to the end. They created Dart, a language designed to replace javascript wholesale, with the knowledge that it would need to compile into javascript for a while to keep everything standard on the web.
What does Dart give us that Javascript doesn’t? Well, we’re only at the preview stage of Dart’s development, so not a whole lot, not from a very technical perspective.
Yes, Dart “just” compiles down to Javascript, which could be said of coffee or any number of other languages built on top of Javascript. Like Coffeescript, Dart can be very opinionated about how that javascript should look underneath.
However, that is where the comparison to coffeescript should end. It is much, much more fair to say that Dart is what you would get if you took a library like jQuery and added your own custom DSL on top like Coffeescript, it is both of those things, not just one. Beyond that Dart provides something that those of us who preach the word of dynamic languages have trouble swallowing. It provides the right syntax for a javascript replacement, which Coffeescript does not.
“Now hold on, what makes you think a cheap java knockoff is the right syntax,” is the natural reply.
Well, here’s my argument for it. Javascript is universal to developers. We hate it, we often gnash our teeth and whine over the stupid idiosyncrasies of it, but we all know it to some degree. Coffeescript borrows its syntax heavily from the world of dynamic languages. That is a great thing for those of us who live and breathe the dynamic and/or functional paradigm, but for a java developer? For an ASP.net developer? The syntax of Coffee looks foreign.
I would challenge you to show me a single developer who feels that the Dart syntax looks and feels foreign. Plenty of developers might complain that it looks old, boring and dated, but foreign? I doubt it. Spend five minutes looking over the code of some of Google’s sample Dart projects and you understand what they’re doing. It’s a simple, class based, C-style syntax. It isn’t cool, it’s not hip and it’s not beautiful. What it is, is universal.
Replacing a language we all know (and hate to varying degrees) requires that sort of universal recognition. I will never love Dart for its poetry, and it may very well fail miserably, google has never been afraid to fail, but I do feel that as we move forward into the future of web technologies we have to accept that pushing a dynamic paradigm on the masses will be very difficult.
But a cheap java knockoff? Who can really be confused by that?
Dart in uninspired, yes. OK, I can live without optional parens, loop comprehensions and other fluffy things. But then I’m still looking for the added value of Dart. Not even talking about its huge drawbacks (no support or recognition, no IDE or debugger), what can it do that JS can not? A tad speedier maybe? A bit more structured? A more familiar object syntax, easy modularity… These are small things.
Then I wonder if Dart remains flexible enough to have its jQuery, because the DOM manipulation examples in Dart are just horrid, imo. Does Dart support open classes, prototypes and all the magic (and dangers) of truly dynamic languages?
Sidenote, I couldn’t make any sense of this : “Dart is what you would get if you took a library like jQuery and added your own custom DSL on top like Coffeescript”. Dart is heacy compared to both, Dart syntax is unflexible and doesn’t allow DSLs. What did you mean?
I was referring to Dart itself as a DSL, which is perhaps over simplifying it. Dart is not a truly dynamic language, at least not in its current version. I think that might be okay. In my view Dart is something different than Coffee and jQuery, in that it serves the purposes of both at once.
I do strongly disagree with the statement that more structure, better speed and more familiar object syntax are small things. From a technical perspective (machine-level) that might be true, from a development or developer-hiring perspective, those can be huge.
Note: I’m not defending Dart per-se. I won’t know if Dart’s advantages outweigh its disadvantages until I use it, and Google themselves have made it clear it isn’t production ready, so that probably won’t be any time soon,