Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Bullseye! – Let's play Dart

Bullseye! – Let's play Dart

JUG Erlangen Nürnberg – 2014-12-11

Avatar for Florian Hirsch

Florian Hirsch

December 11, 2014

More Decks by Florian Hirsch

Other Decks in Programming

Transcript

  1. DESIGN GOALS Structured yet exible programming language for the web.

    Familiar and natural to programmers. Appropriate for the full range of devices on the web. Tools to support all major modern browsers. Florian Loitsch / Riviera DEV, 20.10.2011 Dart: An Introduction
  2. CRITICS — Brendan Eich “I guarantee you that Apple and

    Microsoft (...) will never embed the Dart VM. So 'Works best in Chrome' and even 'Works only in Chrome' are new norms promulgated intentionally by Google.”
  3. SPEED OF DART 10.10.2010: First Announcement on GOTO Aarhus 14.11.2013:

    1.0 25.06.2014: 1.3 – ECMA-408 26.06.2014: 1.5 27.08.2014: 1.6 15.10.2014: 1.7 28.11.2014: 1.8
  4. SCRIPT-LIKE const THE_ANSWER = 42; print('half of the answer is

    ${THE_ANSWER / 2}'); var list = [1, 2, 3]; list.forEach((e) => print(e)); var map = { 'foo' : 12 }; map['bar'] = 13; map.forEach((k, v) => print('$k * 2 = ${v * 2}')); concat(a, b) => a + b; var foobar = concat('foo', 'bar');
  5. JAVA-LIKE /// the superhero class class Superhero { String name;

    Superhero(this.name); toString() => 'I am $name!'; } main() { Superhero batman = new Superhero('Batman'); print(batman); }
  6. FAMILIAR uses curly braces :) only true is truthy only

    null – no undefined no hoisting
  7. SYNTACTIC SUGAR class Superhero extends Person with SuperPower { String

    name; String _realName; Superhero.withRealName(this._realName); String get realName => _realName; set realName(realName) => _realName = realName is String ? realName : 'UNKNOWN'; void train({times: 1}) { } Team operator +(Superhero other) => new Team([this, other]); } main() { var superman = new Superhero.withRealName("Clark Kent")..name = "Superman"; superman.train(times: 4); }
  8. NEW class Cache { static final Cache _INSTANCE = new

    Cache._internal(); static Map<String, String> _store; factory Cache() { if (_store == null) { _store = <String, String>{}; } return _INSTANCE; } Cache._internal(); } var cache = new Cache();
  9. LIBRARIES built-in modules unit of privacy every Dart App is

    a library Pub the package manager (> 1400 libraries)
  10. BUILD AND DEPLOYMENT dart2js Dart VM (Standalone / Chromium) Language

    VM (no bytecode!) Full / Script / Object Snapshots Docker Images on AppEngine