Google last month launched a Web programming language called Dart intended to address the shortcomings of JavaScript, and some have even called it a JavaScript killer. Accommodating large programs and team-based development, Dart is object-oriented and uses a virtual machine. InfoWorld recently interviewed Lars Bak, the lead software engineer for Dart, to better understand Google's intentions for the new language.
InfoWorld: Please explain the intent behind Google Dart, and is it a JavaScript killer, which it has been called?
Bak: I think it's an exaggeration. What we are trying to do here is make sure that developers have an alternative. In particular, we are trying to target with Dart application developers who are building large applications. JavaScript is a great language for simple Web applications, but as you grow the application, it gets harder and harder to keep the structure of the program in JavaScript. Dart is basically designed to [be] a programming language that will suit big applications well, and it will support program development where you have multiple teams working on the same source base.
[ Dart hits a bull's-eye for Web developers, InfoWorld columnist Neil McAllister says. | Peter Wayner reveals what's hot in scripting languages. | Subscribe to InfoWorld's Developer World newsletter for the key news and insights on software development. ]
InfoWorld: Is that what you mean by Dart being a language for structured Web programming?
Bak: It is. You can write small applications in Dart, but as the applications scale, you can start adding types to your programs, and that really specifies a programmer's intent. So if you make a module, you can see exactly how you're supposed to use the module based on the types you have specified in the interface and you can also check that in Dart. If you really have big teams working on the same source space, this actually makes a lot of sense.
InfoWorld: What is the benefit of Dart running on both clients and servers?
Bak: It's like any other language that runs on both sides. You can decide late in the process whether you want the code to be running on the server or in the client. You have to bear in mind that if you are writing Web applications, clients are very different. You have a Web browser on a desktop, which is very powerful, and you can put a lot of logic on the client side. But if you run a mobile phone, which also has a Web browser, you often want to off-load some of that code on the server side. If the application, both on the server side and the client side, is written in the same language, you have the option of deciding where the code should execute.
InfoWorld: I understand that Dart actually compiles to JavaScript code. Why not just use JavaScript then?
Bak: Well, because we have something else. We have a Dart virtual machine developed for the language that gives faster performance and better startup time. One of the problems in my mind with JavaScript is if you have a big application, it takes a long time to start the Web application using JavaScript. If you would have used a Dart VM, we have an infrastructure called snapshotting that will allow an application to start 10 times faster. What we can see is Web applications are getting larger and larger, and as they grow bigger, startup performance is very important.
InfoWorld: How hard is it going to be for developers to learn the Dart language?
Bak: We have been very careful when designing the language so that if you know JavaScript and if you know a class-based language like Java or C#, you should be able to be productive within a day. It has been designed exactly to be very unsurprising to JavaScript and C# programmers.
InfoWorld: Do you really think Dart can displace JavaScript or supplement it? What kind of impact do you think it's really going to have?
Bak: I think it will have a great impact if you write big applications because you get more structure. It's hard to predict what kind of impact because whether programming languages are accepted has a lot to do with taste and if people like it, basically, and that's really hard to predict. We have to make sure that we can display what we have, and we have good implementations of it so people can try it out and if they like it, I'm pretty sure it will be adopted. There's been, of course, language experts who have been questioning some of the design decisions, but most programmers -- mainstream Web programmers -- have been fairly positive toward it. Everything has been open source, so that's a very liberal license. You can just take it and use it without any restrictions. It's a BSD license.
InfoWorld: What is the difference between Google Dart and Google Go?
Bak: Google Go is a systems programming language, which is useful for back-end services, whereas the Dart language is used more for the client side. And one way to make that difference very clear is that Dart is also a scripting language, so the Dart VM will read any source code directly and execute it without any sort of apparent compilation process. Whereas if you use Go, you will have to compile it just like if you program it in C or C++.
InfoWorld: What is the status of Dart at this point?
Bak: It's a technology preview. We wanted to get the language out very early on. There's a draft of the language specification, that and a translator from Dart to JavaScript, and there is a Dart virtual machine available. And [recently] we also put in a programming environment, so you can have a nice tool for trying out Dart. It will take months before we have something ready that can be used for serious development, but we think it's very important to get it out early so we get feedback and can change the language and the implementation accordingly.
InfoWorld: What is the client platform support for Dart?
Bak: If you translate it to JavaScript, it should run in all modern browsers. I think if you're talking about the Dart virtual machine; it has been developed already, so it runs on a variety of operating systems.
InfoWorld: Is Dart is going to be applicable to Android programming?
Bak: Not right now it's not. Right now it's only out in this open source repository, and it's not integrated into Android at this point.
InfoWorld: So it might be in the future?
Bak: We hope that a lot of platforms will take our basic technology and integrate it. It's a little bit like when we did the V8 JavaScript engine. We put it out in open source and several companies picked it up and used it for their products. We hope the same will happen with Dart.
InfoWorld: Is there anything else you wanted to say about Google Dart?
Bak: Well, as part of the preview, if you go to the open source repository, we have an interesting app -- a newsreader called Swarm, which is composed of 15,000 lines of Dart. We have that running both on the VM and translated to JavaScript. That's an example of code where it works beautifully either if you run on top of an existing browser or if you use the Dart VM.
This story, "InfoWorld interview: Why Google Dart beats JavaScript," was originally published at InfoWorld.com. Follow the latest developments in programming at InfoWorld.com. For the latest developments in business technology news, follow InfoWorld.com on Twitter.