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

Join the Dart Side of Web Development ( Codemotion Naples Tech Meetup 2015 )

Join the Dart Side of Web Development ( Codemotion Naples Tech Meetup 2015ย )

Presenting an alternative way to develop Web App : Dart

Giovanni Laquidara

February 26, 2015
Tweet

More Decks by Giovanni Laquidara

Other Decks in Technology

Transcript

  1. Giovanni Laquidara Join the Dart Side of Web Development. [email protected]

    - Google Developer Group Roma Naples February 25th 2015
  2. MILAN november 28th/29th 2014 โ€“ Speaker's name require.js Backbone Backbone

    Marionette jQuery Modernizr moment.js dest templates
  3. MILAN november 28th/29th 2014 โ€“ Speaker's name require.js Backbone Backbone

    Marionette jQuery Modernizr moment.js dest templates PhantomJS
  4. MILAN november 28th/29th 2014 โ€“ Speaker's name require.js Backbone Backbone

    Marionette jQuery Modernizr moment.js dest templates PhantomJS Jasmine
  5. MILAN november 28th/29th 2014 โ€“ Speaker's name require.js Backbone Backbone

    Marionette jQuery Modernizr moment.js dest templates PhantomJS Jasmine Docs Docs Docs Docs Docs Docs Docs Docs Docs
  6. MILAN november 28th/29th 2014 โ€“ Speaker's name require.js Backbone Backbone

    Marionette jQuery Modernizr moment.js dest templates PhantomJS Jasmine Docs Docs Docs Docs Docs Docs Docs Docs Docs
  7. MILAN november 28th/29th 2014 โ€“ Speaker's name require.js Backbone Backbone

    Marionette jQuery Modernizr moment.js dest templates PhantomJS Jasmine Docs Docs Docs Docs Docs Docs Docs Docs Docs
  8. MILAN november 28th/29th 2014 โ€“ Speaker's name โ€ข Language โ€ข

    Libraries โ€ข Tools โ€ข Compilation to Javascript
  9. MILAN november 28th/29th 2014 โ€“ Speaker's name Dart is open

    source โ€ข BSD-style license โ€ข dart.googlecode.com โ€ข GitHub mirror โ€ข Contributing guide โ€ข ECMA Standard (TC52) โ€ข Production ready (1.8)
  10. MILAN november 28th/29th 2014 โ€“ Speaker's name import 'dart:math' show

    Random; // Import a class from a library. void main() { // The app starts executing here. print(new Dice(n: 12).roll()); // Print a new object's value. } class Dice { // Define a class. static Random shaker = new Random(); // Define a class variable. int sides, value; // Define instance variables. String toString() => '$value'; // Define a method using shorthand syntax. Dice({int n: 6}) { // Define a constructor. if (4 <= n && n <= 20) { sides = n; } else { throw new ArgumentError(/* */); // Support for errors and exceptions. } } int roll() { // Define an instance method. return value = shaker.nextInt(sides) + 1; // Get a random number. } }
  11. MILAN november 28th/29th 2014 โ€“ Speaker's name class Hug {

    num _strength; num get strength { // some code return this._strength; } set strength(num value) { // do something with value; this._strength = value; } }
  12. MILAN november 28th/29th 2014 โ€“ Speaker's name class Hug {

    num _strength; Hug(strength) { this._strength = strength; } Hug.light(strength) { this._strength = 0; } }
  13. MILAN november 28th/29th 2014 โ€“ Speaker's name class Hug {

    num _strength; Hug(this._strength); Hug operator +(Hug other) { return new Hug(strength + other.strength); } }
  14. MILAN november 28th/29th 2014 โ€“ Speaker's name var button =

    new ButtonElement(); button.id = 'fancy'; button.text = 'Click Point'; button.classes.add('important'); button.onClick.listen((e) => addTopHat()); parentElement.children.add(button);
  15. MILAN november 28th/29th 2014 โ€“ Speaker's name var button =

    new ButtonElement(); ..id = 'fancy'; ..text = 'Click Point'; ..classes.add(โ€˜important'); ..onClick.listen((e) => addTopHat()); parentElement.children.add(button);
  16. MILAN november 28th/29th 2014 โ€“ Speaker's name Missing getter? "Coffee".missing

    // ?? Class 'String' has no instance getter 'missing'. NoSuchMethodError : method not found: 'missing' Receiver: "Coffee" Arguments: []
  17. MILAN november 28th/29th 2014 โ€“ Speaker's name String compared to

    number? โ€œ2โ€ > 1 // ?? Unhandled exception: Class 'String' has no instance method '>'. NoSuchMethodError : method not found: '>' Receiver: "2" Arguments: [1]
  18. MILAN november 28th/29th 2014 โ€“ Speaker's name void main() {

    String name = "Giovanni Laquidara"; print(initials(name)); } String initials(String name) { StringBuffer retValue = new StringBuffer(); name.split(" ").forEach( (String part ) { retValue.write(part[0] + '.'); }); return retValue.toString(); }
  19. MILAN november 28th/29th 2014 โ€“ Speaker's name main() { var

    name = "Giovanni Laquidara"; print(initials(name)); } initials(name) { var retValue = new StringBuffer(); name.split(" ").forEach( ( part ) { retValue.write(part[0] + '.'); }); return retValue.toString(); }
  20. MILAN november 28th/29th 2014 โ€“ Speaker's name import 'dart:html'; InputElement

    toDoInput; UListElement toDoList; void main() { toDoInput = querySelector("#to-do-input"); toDoList = querySelector("#to-do-list"); toDoInput.onChange.listen(addToDoItem); } void addToDoItem(Event event) { LIElement newToDo = new LIElement(); newToDo.text = toDoInput.value; toDoInput.value = ''; toDoList.children.add(newToDo); }
  21. MILAN november 28th/29th 2014 โ€“ Speaker's name import 'dart:async' show

    Future, Completer; void main() { loadNews().then( (news) { //Do something with news }); print("Just print!"); } Future loadNews() { Completer completer = new Completer(); //Insert very slow process here completer.complete(); return completer.future; }
  22. MILAN november 28th/29th 2014 โ€“ Speaker's name import 'dart:io'; main()

    { HttpServer.bind(InternetAddress.LOOPBACK_IP_V4, 4040) .then((HttpServer server) { print('listening on localhost, port $ {server.port}'); server.listen((HttpRequest request) { request.response.write('Hello, world!'); request.response.close(); }); }).catchError((e) => print(e.toString())); }
  23. MILAN november 28th/29th 2014 โ€“ Speaker's name name: gdghunt description:

    A application using google play game services version: 0.1.0 author: Giovanni Laquidara dependencies: googleapis: any googleapis_auth: any browser: any core_elements: ">=0.2.0 <0.3.0" polymer: ">=0.12.0 <0.13.0" paper_elements: ">=0.1.0 <0.2.0" pubspec.yaml
  24. MILAN november 28th/29th 2014 โ€“ Speaker's name main Library baz

    foo bar boo imports calls baz main foo bar Tree shaking dart2js The web is full of links, yet web dev has no linker
  25. MILAN november 28th/29th 2014 โ€“ Speaker's name Designed for Dart:

    use classes, annotations, and more. Build apps that scale.
  26. MILAN november 28th/29th 2014 โ€“ Speaker's name Designed for Dart:

    use classes, annotations, and more. Build apps that scale. AngularDart brings the proven Angular philosophy of testable, succinct web development to Dart.
  27. MILAN november 28th/29th 2014 โ€“ Speaker's name Designed for Dart:

    use classes, annotations, and more. Build apps that scale. AngularDart brings the proven Angular philosophy of testable, succinct web development to Dart. AngularDart embraces modern web platform features, starting with Shadow DOM and Web Components.
  28. MILAN november 28th/29th 2014 โ€“ Speaker's name Homepage: https://dartlang.org API

    Reference: https://api.dartlang.org Pub Packages: https://pub.dartlang.org
  29. MILAN november 28th/29th 2014 โ€“ Speaker's name Giovanni Laquidara +GiovanniLaquidara

    @joaolaq joaobiriba thanks() => new FeedBack(); getQuestions().then( (what) { answer(what); });