3 reasons why Dart’s so cool (from #flydart)

This week I led the Philly Dart Flight School with the fabulous folks at Philly GDG/Android Alliance. My idea for hosting the meetup went a little something like this:

Me: Hey people, this is a neat worldwide thing. Also, they should send us swag [sad spoiler: swag shipping ruined by snow]
GDG people: Eh, why not.

Well, they were a little more excited than that. We ended up with a packed room (literally! we ran out of chairs!). The only photo I know of (unless any of those people with Glass took some), from Chad Oh’s 20:36 photos:

Anyway, I said there’d be 3 cool things about Dart. And there shall be! I gave the talk at the Flight School based on materials from Google. I found it kind of interesting that instead of an “Intro to Dart” it wasn’t so much “here’s how you create objects” like I’d teach Ruby, it was “here’s what makes Dart different.” Here’s 3 of those cool things.

1. No undefined, no truthy, etc.

Dart imagines itself as what JavaScript would be if JavaScript were designed as it’s used today (made any sense?). Open Dart in an editor, and it looks a lot like Java, honestly. However, it’s meant for the web, and for most environments (that don’t support Dart) you’ll compile to JS. So getting to write JS that doesn’t need to know about undefined? About the difference between true and truthy? Pretty nice. The Java-ness bothers me a bit, so I keep re-reading “Isn’t Dart a lot like Java?” from the FAQ.

2. Operator overriding!

This is cool. You know how in JavaScript you can add two types and just … stuff happens? In Dart, you can specify that behavior. Ex:

Cat operator +(Cat other) {
  return new Kitten(dna + other.dna);
}

When I add two cats together, I want a new kitten! (My husband is taking genetics. Possibly related to this example).

3. Errors!

It’s awesome to get errors! Errors that make sense, that is. In Dart, you’ll get errors that actually relate to WTF happened generally, rather than stepping into whatever corner of jQuery your method effed up on. Check out the examples from the slides.

I definitely only learned enough Dart to host the event, but am interested in checking it out more, especially so I can be impressed at its promised performance (it’s doing its best to beat native JS, already beating it in a couple benchmarks). After the talk, we had open time for people to check out the codelabs available for Flight School. Thanks to everyone who came, to Google for the materials, and to Android Alliance for being awesome!

Tags: , , ,

No comments yet.

Leave a Reply