BT

Kevin Moore on Dart
Recorded at:

Interview with Kevin Moore by Barry Burd on Jul 26, 2013 | NOTICE: The next QCon is in London Mar 2-6, Join us!
21:47

Bio Kevin Moore is a consultant specializing in open source web technologies. His experience includes UI platforms in .NET, web applications in Rails, and cutting edge games in Javascript. Kevin is committer and Google Developer Expert for Dart. His projects have highlighted the potential for building rich experiences with Dart. He is the creator & maintainer of popular open source Dart libraries

Software is Changing the World. QCon empowers software development by facilitating the spread of knowledge and innovation in the developer community. A practitioner-driven conference, QCon is designed for technical team leads, architects, engineering directors, and project managers who influence innovation in their teams.

   

1. I’m Barry Burd from Drew University from Madison, New Jersey, I am speaking with Kevin Moore today. Kevin, tell us a little about yourself and what you are thinking about these days.

Sure. I am freelance consultant software engineer, I did a bunch of work in .NET, worked at Microsoft for a while on some of their .NET UI platforms, moved to open source stuff in 2007, did a bunch of Ruby on Rails, a bunch of JavaScript, Node and then I stumbled upon the Dart work from Google about a year ago and having done a bunch of work using Google’s Closure compiler tools for JavaScript to build bigger more structured JavaScript applications I said “finally, there is a syntax that exists”, so I’ve been playing with Dart for a year now, done a few projects with Google using Dart and I am a Google developer expert for Dart, so I guess I’ve been involved enough in the Dart project and I think that’s interesting, I’m also a committer on the Dart project.

   

2. Tell me all about Dart. If you could describe Dart in 25 words or less or more, what is Dart?

25 words might be tough. What is Dart? I think the marketing speak would be “A great way to build... a great set of tools, language, runtime to build structured, complex, web experiences without pulling your hair out”. I think Google especially and certainly a lot of people in this community are looking to build more complex, more “real world” experiences on the web and I personally find a lot of issues, I know a lot of people find a lot of issues scaling up JavaScript, so there is CoffeeScript, and there’s TypeScript, module JS, and all these other tools to try to put JavaScript on some rails on some conventions and it turns out the amount of boilerplate you need to do to make reasonable JavaScript apps is really tough. And so, Dart adds a lot of that structure around typing, around a model for classes and types, a model for libraries and packages and then the wonderful thing is all that can be used to generate JavaScript and build apps that run on IE9 and any modern browser, but the upside is they are also working on a virtual machine and once that gets into Chrome of other browsers that are interested there are some substantial opportunities for amazing performance, 2x or 3x performance beyond what we can do in JavaScript which is great for battery life and also it is great for the class of apps you can consider building in a browser.

   

3. Dart is an alternative to JavaScript, it’s a virtual machine, is it more than that? Is that the Dart ecosystem or are we talking about something even broader, like HTML5?

That’s a great question. So, the simple way to think about Dart if you are running Firefox or Safari or IE or Chrome for that matter in the short term, it’s just another way to generate JavaScript, like CoffeeScript is or GWT is, so there are great tools to generate JavaScript, but that’s pretty simplistic. Because there is actually a runtime behind Dart and it had a type system, you have a whole set of tools that make working in Dart really easy, so you have an editor and a type analyzer so you actually get the behavior you have come to expect if you’ve done Java or C# or C for that matter around inline errors and warnings around how you are using things. You can actually run in a debug mode and get errors if you call the method with too many members or not enough arguments or with the wrong types. So that actually gives a much higher level services that you’ve come to expect from a more structured language like a C# or a Java and then the ecosystem is amazing. They already have package management, things that took a while in the JavaScript world, they have a server environment that ships out of the box, you don’t have to wait for someone to come up with Node for Dart, you have a Dart.exe and SDK and you can run Dart commands in the shell, I have a whole video series talking about running Dart in the shell, you can build servers in Dart, so it's really a kind of a soup to nuts thing.

   

4. Now, one of the criticisms of JavaScript is that it’s so easy to write bad code in JavaScript. What about Dart?

It’s funny, I had a conversation last night about this. It’s tough to make bad things impossible or difficult, sometimes you shoot yourself in the foot trying to make bad things difficult, but making the right thing easy, kind of the pit of success, I find this much more in Dart. There is no discussion about “How we are going to handle module loading or about how are we going to handle importing libraries?”, that just happens, there are models for packages and libraries, “How are we going to structure classes?”, there is one way to structure a class and adding on to that a type system around “How am I going to annotate my code around what types of arguments I accept or return from a function?”, no, use the type annotation and not only do you get great documentation on much more readable code you also get the upside of the compiler can reason about all these things, the analyzer can reason above all these things and give you good errors, really just upping the set of things that you get when you’re navigating code and editing code that you really don’t get in JavaScript. You’d be able to get the right click and say go to definition for type and it’s not a string search it actually understands the structure and knows which toString you are talking about when you say go to definition. And that’s just really powerful from a productivity perspective.

   

5. You compared Dart with CoffeeScript. Can you say a little more about that?

Sure. I think people have realized that JavaScript is amazing, the fact that it runs everywhere, at least with more modern browsers it runs consistently everywhere, it’s pretty nice, the performance is great. But coding in JavaScript directly has lots of downfalls, there are lots of ways to do things, lots of ways to do things wrong. So, CoffeeScript was a forefront, a vanguard, that said “We can code in a different language, a different structure that might be easier to understand, offer new features, help you avoid bad features of JavaScript and then JavaScript has a target for a compiler or a transpiler”, Dart is similar in that respect, you can take a Dart project and generate JavaScript and it runs on all modern browsers. So in that respect they are analogous. The set of features you get with Dart is certainly much more than with CoffeeScript, you actually have an editor, you have a type system that understands this, you have a virtual machine that runs Dart code directly, you can debug in Dart code directly, you write server apps that actually run natively in a Dart virtual machine. So, you can use Dart everywhere you use CoffeeScript now because it generates JavaScript, it runs in every browser, but it certainly does more than what you can do in CoffeeScript because the scope of the project is much bigger.

   

6. You’ve been quoted as saying that JavaScript will never go away and that that’s awesome. Can you elaborate?

Sure, I don’t think JavaScript will ever go away, it’s been so widely implemented, the target for Dart is IE9 and above, once you look at browsers in that set of things it’s easy or relatively straightforward to write apps, at least in JavaScript where the performance and the behavior are very consistent. I can’t imagine any implementation getting that broadly applied across browsers, so that’s a good thing and what’s great is that if it becomes a world where people are using higher level tools to generate JavaScript and JavaScript becomes a thing that everyone counts on to be on every browser, that’s sufficient. Just like I don’t like writing HTML, I like writing Haml, because Haml has much better syntax, I know people in the Node world write Jade, it’s not that they hate HTML, it’s great that HTML is out there, it runs on every browser but in terms of input, in terms of what we code or how we think about it, use whatever tool you want, it’s the fact that it’s standardized and the features exist is the important thing.

   

7. You’ve been quoted as saying that the Dart virtual machine is amazing and exciting. How about that, tell me about it?

The Dart virtual machine is an amazing opportunity. After having some discussions and reading some things about the inspiration behind doing a new virtual machine for the web, it basically came down to, they are looking at what you can do in JavaScript and what the V8 engine has to do to be compatible because obviously if you look at V8 and some of these other engines performance has been amazing and seeing the same JavaScript and the performance you can get out of it has been growing a lot but it has started to plateau and that’s just because if you want to have a valid virtual machine in JavaScript that’s doing JITing and other things, there’s a whole set of issues that you need to be cautious about. People can change, the prototype chain at any point, you change the shape of classes and the shape of objects at any point in the runtime.

It turns out supporting that from a runtime’s perspective actually makes a lot of things inefficient so the guys that were working on the V8 engine said “We can get a lot more performance from a similar structure”, 2x or 3x, maybe 5x, some of the things they’ve talked about and get performance more analogous to what you get with Java, but you need to remove features. And once they made a list of things they realized at this point it’s not tweaking two things in JavaScript or adding two things, it’s really a new language, and so they took an opportunity to start from scratch and if you look at the benchmarks you’re seeing very commonly used, commonly referenced benchmarks with performance 2x, in some cases 3x what you get in JavaScript and this is only with their pre-v1 language, they’ve only been optimizing for the last six months. And so being able to have that kind of performance in the browser is an amazing opportunity, also with the benefit that you can still generate JavaScript and run it in any browser that supports JavaScript, so those two benefits are really substantial and I am excited about seeing it in Chrome, hopefully, seeing in on mobile on Android, at a minimum, just in terms of the types of apps I can write.

   

8. So, you said that the Dart virtual machine is amazing and exciting but you also said folks shouldn’t get distracted by the Dart VM when talking about all the benefits of Dart.

Absolutely. I think, maybe coming from Microsoft a little bit, having experience with Flash and Air and Silverlight, this idea that there is some kind of proprietary thing that only some browsers implement or if you download a plugin, it feels like it breaks the web, it feels disingenuous, it feels scary, I like the standards based things and things you can count on being broadly applied, I don’t have to worry about one vendor’s implementation. So, I think a lot of people when they see Dart and see virtual machine, the first question is what now, will IE ever support Dart, with kind of a wink and realizing they think it will never happen. And from my perspective if Dart gets no further than being what CoffeeScript is with a lot better tooling and the ability to actually debug in the native language without having to worry about source maps, it’s already spectacularly productive, if I never had to worry about a Dart virtual machine being deployed in the wild, if I could just code in Dart and generate JavaScript, in terms of my productivity and the quality of apps I can build, the speed at which I can build large systems, Dart, I am already sold on.

   

9. And so in other words you would use Dart as a development environment and then actually deploy in JavaScript.

Right. And honestly, even if the Dart VM, if Android picks up a version of Chrome with Dart in the Chrome browser, and only a third of people in the world at some point run Dart you’ll still take every app and generate JavaScript for it and you’ll do feature detection like you do with other formats right now, so you’ll always have a world at least from my perspective where JavaScript will exist and that’s great.

   

10. Are the line items of Dart new or special or surprising or is it how they are all brought together into one place?

There is not a lot of new stuff in Dart in terms of things I haven’t seen before. I love the way it handles asynchronous programming, they have a model called Future but that’s analogues to Promises in JavaScript spec or Tasks in the Task Parallel library in .NET. They have a notion of Stream which is great again for asynchronous IO but that’s analogous for things that exist in .NET and Java already. It’s really just the combination of things. So, there are some great features in Dart in terms of how you structure apps and build constructors that are analogous of things you see in CoffeeScript. Coming from a .NET background in terms of how I think about generics and how I think about doing asynchronous programming there’s lots of things picked up there that look very similar and familiar. So for me it’s really about how these things are brought together, I can think in Dart, I never left one thing, there’s a few things that I left one thing but generally I feel like I can think in Dart and be productive in Dart.

   

11. Are there either some new or special or surprising things in Dart?

I think the big thing especially for someone that is used to doing JavaScript development when you are worried about building a performant app and having a small app, what I get excited about when talking to JavaScript people is you’ve got a Twitter Bootstrap and you say download a custom build and you go through this check box and I only want certain things and you download some minified JavaScript library and it’s only 4k because you worry about download size, you want to make sure you download these giant libraries and it seems so broken from an engineering perspective, really what you want is use some giant library and then use a tool set that will go figure out what you are using, what you are not using and bring it in whether generating Dart or JavaScript in that respect. And there are some tools that do that already but just in terms of engineering flow you don’t have to prematurely optimize the size of your code by cherry picking libraries, the tools help you with that. And so from my perspective especially coming as a web guy realizing that you are already doing minification, you’re already doing concatenation for deployed apps, whether you are doing a web app in Rails, Node or anything else, these tools and processes already exist and the fact that Dart makes that easier and more straightforward and less hassle, it’s just a great model. So, I think what’s new is bringing some things that we take for granted in C# and Go for that matter or Java and giving these features to web developers, it’s like “no, you don’t have to worry about preconfiguring the library you use, import all 50 MB and the tools will figure out what you use and make it efficient.”

   

12. What about the enterprise? How do web components and the Dart Web UI fit in, what are the implications for enterprise developers?

I worked on UI frameworks a little bit in Microsoft, so understanding the ecosystem that is expected in the enterprise you want components that are drag and drop, easy to understand, encapsulate a set of set of functionality, you want to be able to import libraries in a very seamless, simple way, people expect a lot from the IDEs in terms of statement completion and a notion of types and some babysitting there and that really doesn’t exist in the web right now, but what’s interesting is if you look at the caliber and the insanity of what people are building with web stuff, WebGL and Google Maps and Gmail, you can build really complex apps on the web right now and so I think for a lot of enterprises it’s not such a matter of they don’t know they can build their app on the web or the browser couldn’t support whatever their line of business app they’re building, it’s that the tool flow that exists for their developers has not evolved there to take a Java dev or a C# dev and say go write web apps now; it feels very different, you feel like you’re out in the woods, you have to glue all these together, like random JavaScript pieces and in a lot of ways I think Web Components helps with that because there is this notion of this is a component, you drop it in your HTML like you drop in a table tag, a div tag, but it can be a data grid or a charting control.

And so it’s not dealing with jQuery and some random class initialization, it’s exactly like you do from Infragistics or ComponentOne. And then likewise, the language support around having a reasonable notion of packages and libraries, notions of statement completion, all those things, you really can have a visual studio like experience, obviously the UI editor isn’t there yet in terms of drag and drop, but in terms of components and the features you want from HTML and from the language, it’s at the point where I think you’ll see a big shift and people that are looking at their XP license wondering if they want to move forward with that it’s an amazing opportunity to start looking at building much more of these apps that have kind of languished on 5 or 10 year-old platforms and really seriously consider the web.

   

13. To what extend is Dart ready or not ready for the enterprise?

I think, I am dealing that right now with some clients actually, Dart is still pre-v1 as of June 2013, there are discussions that it will be out as version 1 this year, Google has said publicly that they’re supporting Dart, that they are using it on internal projects for some of the similar reasons that I have mentioned here, so I think that once there are hints or more of a stake in the ground about a release date for Dart and once people start seeing how they can apply the knowledge they have in their existing enterprise solutions, how Dart lets you translate a lot of that knowledge and target any browser, these bring your own device corps where people have their Android tablet or their iPad and be able to run their enterprise apps on those things or their internal line of business apps I think that is going to be an amazing thing. A few more months once you get a ship date I am excited to see the flip over there.

   

14. Does Dart help with the following problem: making an app that’s in a browser look more like an app that’s in a desktop?

In some ways. It’s important to know where Dart fits in the overall ecosystem, Dart in many ways does what JavaScript does in terms of set of features, how it talks to HTML and manipulates the DOM, creates elements. Certainly once you start talking about actually running a Dart virtual machine in a browser, the performance improvements will help a lot with a whole class of things around any kind of background processing or background data manipulation that you’re doing, because lots of times people are not downloading a mount of HTML, they’re downloading a bunch of JSON and then they instantiate with templates. And so those kind of processing having a faster virtual machine will help with that, also because the structure Dart lets you create I think people will build more robust libraries, more complicated sets of tools to do more interesting things, so you can worry about one guy making a robust list control that has great filtering and sorting capabilities and not only will it be much easier to write that component, it will be much easier to consume and use that component.

So I think just like you see in the Enterprise you have a small number of people who do a lot of investing in doing data visualization controls or doing data grid controls and right now it’s tough to say if you’re doing jQuery, you should use this version and use these caveats, if you’re using Backbone it’s different, if you’re using Angular it’s different, the fact that a lot of those things are made common with Dart I think will improve. Aside from that it’s winning on browsers, the CSS support, the HTML support are improving in terms of performance and features which is exciting, offline app capabilities, Firefox has their app store and their model for doing more native Chrome apps, as does Chrome for that matter, and so having a full desktop feeling experience from web technology is evolving on many fronts, Dart’s a part of that, I think it helps a lot, but even the app model I think will be another thing that helps around access to local file system, you’ll have your own button on the desktop to make that experience more seamless.

   

15. Tell me about the joy of building non trivial web apps with excitement and not fear.

I saw a great talk discussing why unit testing, this is a little bit of a tangent, is so important when you’re writing an app and his point was you’re not scared of your code, if you know it’s well unit tested, you can code quickly, you can tweak things quickly, you have these assurances from your unit tests that you know you are not going to break too much at least, and that makes you less fearful, you’re more likely to experiment. And so I find having an editor, having statement completion, having an analyzer run in the background and drawing red squiggles if you refactor something incorrectly, being able to walk up and say “I want to rename this method” and click and just do a rename, it’s not a dumb string find it’s actually understand the structure of a code, it makes it much easier to code much more quickly.

The fact that there is even a notion of privacy so I know I can mark things very trivially as private and they won’t be accessible to other components so I can think in terms of encapsulation and sub classing and exposing a reasonable library to a consumer, even if it’s me writing an app and using a library I’ve written myself, it makes me less fearful as a developer, I have much less anxiety as I code around I am going to do something stupid and that makes me more efficient, and it makes me think more about the problem space I am in and not making sure I am checking things off a list that I haven’t done something wrong, because the tool doesn’t solve every problem, but in terms of a whole set of common mistakes you’d make around types, around number of arguments in a method, around mistyping a method name, those are the things that slow you down in unreasonable ways and problems that have been solved for a long time. So having Dart and the editor and the tools and everything else across that set of things just makes me much more productive.

Barry: Kevin, thank you so much for coming today.

Thank you.

General Feedback
Bugs
Advertising
Editorial
InfoQ.com and all content copyright © 2006-2014 C4Media Inc. InfoQ.com hosted at Contegix, the best ISP we've ever worked with.
Privacy policy
BT