• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Introduction to Dart
 

Introduction to Dart

on

  • 599 views

Introductory Tech Talk on Dart. Presented at the GDG Aachen Dart Flight School.

Introductory Tech Talk on Dart. Presented at the GDG Aachen Dart Flight School.

Based on the slides by Seth Ladd:
http://goo.gl/EbY4uS

Statistics

Views

Total Views
599
Views on SlideShare
596
Embed Views
3

Actions

Likes
0
Downloads
2
Comments
0

1 Embed 3

http://mauihub.com 3

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Introduction to Dart Introduction to Dart Presentation Transcript

    • Welcome #flydart #gdgac
    • #flydart #gdgac
    • Introduction to Based on the Slides by Seth Ladd #flydart #gdgac
    • Who am I? Sebastian Mauer aka GDG Aachen Co-Lead CS Student Software Engineer I don’t work for Google …yet #flydart #gdgac
    • #flydart #gdgac
    • is about two things: ✔ Improved productivity ✔ Increased performance #flydart #gdgac
    • Learn the language in under one hour. (we have the whole day) #flydart #gdgac
    • Use the tools you already know IntelliJ Sublime Eclipse (DartEditor) #flydart #gdgac
    • Compile to JavaScript (runs across the modern web) #flydart #gdgac
    • Run Dart on the server with the Dart VM #flydart #gdgac
    • Jasmine Docs PhantomJS Docs dest templates Docs moment.js Docs Modernizr Docs jQuery Docs Backbone Marionette Docs Backbone Docs require.js Docs #flydart #gdgac
    • Packages Clear and consistent Intl Polymer Unit test Dart SDK #flydart #gdgac
    • Apps start small, but grow and scale #flydart #gdgac
    • Simple syntax, ceremony free class Hug { #flydart #gdgac Familiar
    • Simple syntax, ceremony free class Hug { num strength; Hug(this.strength); #flydart #gdgac Terse
    • Simple syntax, ceremony free class Hug { num strength; Hug(this.strength); ! Hug operator +(Hug other) { return new Hug(strength + other.strength); } #flydart #gdgac Operator overriding
    • Simple syntax, ceremony free class Hug { num strength; Hug(this.strength); ! Hug operator +(Hug other) { return new Hug(strength + other.strength); } ! void patBack({int hands: 1}) { // ... } #flydart #gdgac Named, optional params w/ default value
    • Simple syntax, ceremony free … Hug operator +(Hug other) { return new Hug(strength + other.strength); } ! void patBack({int hands: 1}) { // ... } ! String toString() => "Embraceometer reads $strength"; One-line Function #flydart #gdgac
    • Simple syntax, ceremony free … Hug operator +(Hug other) { return new Hug(strength + other.strength); } ! void patBack({int hands: 1}) { // ... } ! String toString() => "Embraceometer reads $strength"; String interpolation #flydart #gdgac
    • #flydart #gdgac
    • #flydart #gdgac
    • Clean semantics and behavior Examples • Only true is truthy • There is no undefined, only null • No type coercion with ==, + #flydart #gdgac
    • Clean semantics and behavior "hello".missing / ?? / Class 'String' has no instance getter 'missing'
 NoSuchMethodError : method not found: ‚missing'
 Receiver: "hello"
 Arguments: [] LOGICAL! #flydart #gdgac
    • Clean semantics and behavior 'hello' > 1 / ?? / Class 'String' has no instance method '>'. LOGICAL! #flydart #gdgac
    • Clean semantics and behavior Variable scope? var foo = 'top-level'; ! main() { if (true) { var foo = 'inside'; } ! } print(foo); / ?? What will this print? / top-level NO HOISTING! LOGICAL! #flydart #gdgac
    • Clean semantics and behavior Scope of „this“? class AwesomeButton { ! AwesomeButton(button) { button.onClick.listen((Event e) => this.atomicDinosaurRock()); } ! } atomicDinosaurRock() { /* ... */ } LEXICAL THIS! LOGICAL! #flydart #gdgac
    • Scalable Structure Packages Libraries Functions Mixins Classes Interfaces #flydart #gdgac library games; ! import 'dart:math'; import 'players.dart'; ! class Darts { / ... / } ! class Bowling { / ... / } ! Player findOpponent(int skillLevel) { / ... / }
    • Too many Buttons var button = new ButtonElement(); button.id = 'fancy'; button.text = 'Click Point'; button.classes.add('important'); button.onClick.listen((e) => addTopHat()); ! parentElement.children.add(button); #flydart #gdgac
    • Method cascades var button = new ButtonElement() ..id = 'fancy' ..text = 'Click Point' ..classes.add('important') ..onClick.listen((e) => addTopHat()); ! parentElement.children.add(button); #flydart #gdgac
    • Inline initialization parentElement.children.add( new ButtonElement()..text = 'Click Point'); #flydart #gdgac
    • One of these things is not like the other Object Persistable Hug is not a is-a Persistable Hug #flydart #gdgac Don’t pollute your inheritance tree!
    • Don’t inherit, mixin! Object Hug #flydart #gdgac Mixin Persistable
    • Mixins abstract class Persistable { save() { ... } load() { ... } toJson(); } ! class Hug extends Object with Persistable { Map toJson() => {'strength':10}; } ! main() { var embrace = new Hug(); embrace.save(); } #flydart #gdgac Extend object & no constructors? You can be a mixin! Apply the Mixin Use Methods from the Mixin
    • #flydart #gdgac
    • pub • A package manager • Integrated right from the start • 670+ packages #flydart #gdgac
    • Dart. Right now. • dart2js compiles Dart to JavaScript • at least until the DartVM is
 available within all platforms #flydart #gdgac
    • Ready to get started? Write a Dart app! (after a short break) #flydart #gdgac
    • Codelab #flydart #gdgac
    • Codelab #flydart #gdgac
    • Hackathon #flydart #gdgac
    • Hackathon Winners #flydart #gdgac
    • Please fill out the evaluation form #flydart #gdgac