Unofficial news and tips about Google

October 10, 2011

Dart, Google's Programming Language for the Web

Google's alternative to JavaScript is not called Dash, the name has been changed to Dart. Designed as an object-oriented programming language that's both flexible and structured, Dart should be familiar to Java and C++ programmers, while inheriting some advantages of scripting languages like JavaScript.

Dart is "a class-based optionally typed programming language for building web applications" and Google says that it's better suited for large-scale projects. "Developed with the goals of simplicity, efficiency, and scalability, the Dart language combines powerful new language features with familiar language constructs into a clear, readable syntax."

Dart is flexible because it's both static and dynamic, it's both for clients and servers and it's useful for both small scripts and large projects. Dart apps are easier to debug, to maintain and to develop collaboratively. The language is optimized for performance and doesn't allow programmers to use features like defining constants that have to be computed at runtime.

For now, no browser supports Dart, but it's likely that Chrome will address this problem in the near future. The code can be executed "either on a native virtual machine or on top of a JavaScript engine by using a compiler that translates Dart code to JavaScript." Google already provides a simple online IDE called Dartboard that lets you edit a small program using your browser, but Dartboard will evolve into a full-fledged online IDE.

Last year, a Google employee admitted that it will be difficult to convince developers and browser vendors to adopt the new language, but the fact that it's easy to convert Dart code to JavaScript is an important advantage. Google will promote it "as the language for serious web development on the web platform" and will "actively push for its standardization and adoption across the board". After all, "the goal of the Dart effort is ultimately to replace JavaScript as the lingua franca of web development on the open web platform." It's hard to say whether it will succeed, but it's worth trying to fix JavaScript's flaws by starting from the scratch. Google will have standardize the language, build development tools and develop powerful apps that use Dart to make a better case.

17 comments:

I love the idea of optional typing. Years ago I pushed the idea of adding optional typing to Python but this was deemed to be incompatible with the Python way. Perhaps that is true, but I'm glad to see that there is now a language that provides this.

It is complicated to implement things which are supported by Google only. If we start coding using Dart then only the Google bots understand the intent. We cannot ignore the other browsers thus would have to use the technology which would work out for all.

Whether this language can gain any traction is certainly a valid question. But I for one have never understood why anybody wants any scripted/interpreted language. Sure not having to go through a compile step is nice - but incremental compiles really mitigate that advantage.

I also don't get the appeal of untyped languages. Is it laziness? How hard is it to specify the type on a variable? after doing so you get all kinds benefits, Speed, debugging checks, tool support etc.

IMO the web desperately needs a language like Dart. I dont know whether it will succeed and tool support may be years away - but I think they are on the right track.

And those of you that disagree... ask yourself if you do so only because the investment you have made in javascript is threatened. To those who think another language is not needed - think again - there is no statically typed web language now (unless you want to write java applets).

"I also don't get the appeal of untyped languages." - The impedance mismatch. It is really easier to use an untyped language when you have to query for a data that don't have a predefined structure. The same thing with mongodb.