Why Dart?

What we should be focused on

Posted 5 months ago by Tom Maiaroto.

So I've read a few posts about Google's Dart vs. JavaScript. I know there's a fair amount of debate regarding Dart and it's value for the web. However, after using Dart for a little while here, I have a different perspective. I believe too many people are confused by it and what it could really offer the web.

Everyone compares it to JavaScript. This is wrong. It's not "replacing" JavaScript and I honestly don't think Google has any delusions about that. It requires a VM in the browser and there's just no way we'll ever see it put into all the browsers out there. I'm usually pretty open minded, but I'm definitely confident that it won't happen. So how could it "replace" JavaScript?

The truth is, it won't and that's ok. I don't believe that to be the point or value of Dart anyway. Dart2Js is just a nice bonus.

Point number one: Back-end use and benefits

Dart was created for performance and because there weren't any single things that could be done to enhance JavaScript. V8 is wonderful and Node.js is great...But Dart is better. For starters, it's number system is better and that provides us with a lot of power. Especially for graphics concerns.

So Dart is better left for the back-end really. I know, the next argument is, why not Go? Well, Dart is more web centric and you can build full stack Dart. Despite not having the VM in every browser, you can convert Dart into JavaScript. It does this quite nicely (for the most part) actually. It has it's "tree shaking" feature that keeps the converted and minified JS code fairly small. They claim it's better than you could write if you were to write from scratch in JavaScript. 

Is that true? Maybe...But it's still not important. What's important to take away here is your work flow. You can use Dart for the back-end and the front-end. Just like JavaScript and Node.js, right? Well sorta. Node.js is JavaScript but you can't just take it and run it in the browser. Parts of it sure, but not all of it. With Dart, you can.

So Dart is a big win for the back-end, rapid development, and keeping things lean. When you blur the lines between the "back-end" and the "front-end" you need less workers to get things done. Less specialization...Less fragmentation...Less points of failure in your work force. It's good for business.

Point number two: Chrome apps and Chromebook.

Google doesn't actually need all browsers to adopt the Dart VM. Chrome apps are becoming more popular and can launch from your desktop, etc. Oh right, the run on Chromebook too. So Google has more than enough devices capable of using the Dart VM (when they put it into Chrome). Chromebooks really help out here.

Dart is so much faster than JavaScript in the browser that it makes things like photo editing and complex graphics a reality. I'll give you an example. There is a wonderful Dart image package that decodes and encodes a variety of image formats - including Photoshop documents! Now, it does this quite fast with Dart. Yes, it works with JavaScript too, but when you work with a 10MB image, it takes a few minutes. Dart on the other hand takes a few sconds.

So how does Chromebook get a Photoshop? Well sure, we can use Aviary if we're ok with Flash. However, Flash is dying for many reasons and more importantly it isn't the best for working with the file system. There's a lot of security restrictions and it has its own problems that I won't get into. Dart is a far better fit on the Chromebook.

If Dart wasn't, at least in part, created to serve the promotion of Chromebooks and their usage (allowing them to actually do more), then I'd be shocked.

So what? To build Chromebook apps you need to know Dart? ...And Dart is only good for Chromebook apps? No. You can use JavaScript for Chromebook apps and you can use Dart2Js for all the other browsers... Again, stop thinking about replacing JavaScript. All Dart does is leave us with more options and makes certain things that were impossible before - now possible.

Other signs of value

If you needed any more hints, how about AngularJS? A lot of folks over at Google are now very interseted in AngularDart. Dart is allowing them to do things with AngularJS that they really couldn't with JavaScript. Though it all converts to run in JavaScript (and uses Shadow DOM). Though the improvements in AngularDart (aside from the Shadow DOM and the idea of components and how they consolidate some features of AngularJS) is more for the developer in my opinion. Dependency injection is nicer and your work flow as a developer is a lot better. The Google team wouldn't be so excited about AngularDart if there wasn't something to Dart (or a future for it).

My experience with it

I recently joined the folks at sonarDesign to work on their platform that enables users to create apps on the web that work across many platforms. Building things once and having them work on mobile and desktop is really important these days.

At sonarDesign, I've built an asset manager for the tool which used AngularDart. It was a really fun experience and to be perfectly honest, it didn't make me miss JavaScript. You still debug in Chrome with developer tools and I code Dart in SublimeText (or Atom.io now) and I run the commands to compile and manage packages from the command line just like Node.js. So it's fine. There's no real barriers to Dart except this stigma.

What Dart means for sonarDesign is a much easier to maintain codebase than pure JavaScript. It allows us to work better together as a team and it provides the content creation platform with the power it needs. There are things sonarDesign is doing that would otherwise be very, very difficult (and time consuming) in JavaScript alone.

Be sure to give sonarDesign's platform a look. There's a long road ahead of it and there's some really exciting new features coming down the pipe soon, but for now it's certainly a great tool for your presentations. It's also very foreshadowing of things to come and the power of possibility. 

Rather than argue about Dart vs. JavaScript, it's important to just look toward the future of the web. Dart is. sonarDesign is. Are you?

Filed under
comments powered by Disqus

Search for Posts

Popular Labels

social media virality score general internet web development reviews and opinions php web tools hosting lithium web design

Recent Posts