versus




                                Christian Grobmeier
                              http://www.grobmeier.de
                                     @grobmeier
Donnerstag, 26. April 2012
•       Programmiersprache   •   Heavy Metal Band aus
                   von Google               England

           •       Kann JS ersetzen     •   Ersetzt Hawkwind

           •       Läuft in einer VM    •   Läuft mit Whisky

           •       Für „ernsthafte“     •   Zur täglichen
                   Anwendungen              Anwendungen

           •       Jung und rockt       •   Alt und rockt


Donnerstag, 26. April 2012
Band



                       Lemmy                Mikkey Dee
            Bass + Gesang                    Gitarre
                                Wizzo
                               Schlagzeug
Donnerstag, 26. April 2012
Band




                    Dart Editor             Dart SDK

                                  Dartium

Donnerstag, 26. April 2012
Releases


                    Lang Spec v0.08 :-(
                      kaum Libraries :-(


                                               21 Studioalben!
                                           + unzähliges mehr
Donnerstag, 26. April 2012
Highlights




                                     + 17 mehr!

Donnerstag, 26. April 2012
Highlights

                             Dart ist „Mainstream“, hat eine
                             main-Methode und kennt nur ein
                                           null.




Donnerstag, 26. April 2012
Highlights


                        Dart kennt Interfaces und Klassen




Donnerstag, 26. April 2012
Highlights

          class MyReceiver extends Isolate {
          }
                             Einfachvererbung

          interface Hobbit extends A, B{
          }
                               Mehrvererbung

          class Frodo
                  implements Hobbit, Hungry {
          }
Donnerstag, 26. April 2012
Highlights


                             Dart kennt optionale Typen


               dart --enable_type_checks App.dart




Donnerstag, 26. April 2012
Highlights


                              Dynamic
             class Frodo {
               var hungry;
               bool sleepy;
               Ring ring;
             }




Donnerstag, 26. April 2012
Highlights

                     Dart does not need to drink whisky.
                             It has whisky in it‘s veins.




Donnerstag, 26. April 2012
Highlights

          class Frodo {
            Frodo(num age) : super() {
            }
          }

          var frodo = new Frodo(111);


                             Konstruktor



Donnerstag, 26. April 2012
Highlights


                         class Frodo {
                           Frodo.eat(){
                           }
                         }
                         var frodo = new Frodo.eat();


                             Ein „named Constructor“ verhält
                                  sich wie ein überladener
                                    Konstruktor in Java.

Donnerstag, 26. April 2012
Highlights



                class Frodo {
                  var hungry;
                  Frodo.cook(this.hungry);
                }

                new Frodo.cook(true);




Donnerstag, 26. April 2012
Highlights

        class Frodo {
          bool _hungry;
          bool get hungry() => _hungry;
          void set hungry(bool x) {
            _hungry = x;
          }
        }

                         Get/Set kann nicht überschrieben
                             werden und können nicht
                                  überschreiben.
Donnerstag, 26. April 2012
Highlights




               Frodo f = new Frodo();
               f.hungry = true;


                                   Setter werden wie
                             Standardproperties aufgerufen.

                             GET/SET Methoden vermeiden!

Donnerstag, 26. April 2012
class Hobbit {                    Highlights
    factory Hobbit() {
      return new Hobbit._internal();
    }

        Hobbit._internal() {
          print("Construct");!
        }
   }

   main() {
     Hobbit hobbit = new Hobbit();
   }
                 Das Factory Pattern mit Dart
Donnerstag, 26. April 2012
Highlights


                             Dart ist Library-Scoped




Donnerstag, 26. April 2012
Highlights
                                            Privacy
               class Frodo {           Public
                 eat(){ }
                 _sleep() { }
               }



                             Private

Donnerstag, 26. April 2012
Highlights
                                          Privacy
             #library(„Frodo“);
             class Frodo {...
                                      Public

             #library(„Mordor“);
             #import(„Frodo.dart“);
             new Frodo()...

         Private Elemente sind nicht sichtbar

Donnerstag, 26. April 2012
Highlights


                             Dart Isolates




Donnerstag, 26. April 2012
Threads => Isolates

                     • Isolates erlauben „multithreading“
                     • Isolates kommunizieren via Ports
                     • Isolates werden durch „spawn“ing erzeugt


Donnerstag, 26. April 2012
Isolates
     <body>
      <script type="application/dart">
       main() {
         // Do some DART
       }                          Isolate
      </script>
      <script type="application/dart">
       main() { }
      </script>
     </body>

Donnerstag, 26. April 2012
Isolates


                                  Light                Heavy

       •Leben im gleichen Thread                 •Erzeugen einen neuen Thread
       •Nur ein Isolate auf einmal               •Mehrere Isolates auf einmal

                             Dart entscheidet über den Geschmack.
                              Isolates können keine States teilen!
                                Isolates sind immer asynchron!

Donnerstag, 26. April 2012
Isolates

    process() {
      port.receive((var m, SendPort r) {
          print ("Got message: ${m}");
          r.send("close");
          port.close();
      });
    }




Donnerstag, 26. April 2012
Isolates
  main() {
    port.receive((var m, SendPort r) {
      print("Got message: ${m}");
  !   port.close();
    });

  ! SendPort s = spawnFunction(process);
    s.send("start", port.toSendPort());
  }


Donnerstag, 26. April 2012
• Kein Multithreading - einmal Motörhead,
                         immer Motörhead
                 • Mit Motörhead ist man niemals einsam
                 • Ist der eine Thread einmal beendet, gibt es
                         keine neuen Alben mehr



Donnerstag, 26. April 2012
Road Crew

                      •      HTML

                      •      Templates

                      •      JSON

                      •      Dartdoc

                      •      Frog

                      •      etc.
                                           •   We are the Road Crew

                                           •   Unbekannte Personen

Donnerstag, 26. April 2012
HTML Library

          document.query('#myid');
          document.query('.foo');
          document.queryAll('.foo');


                              Inspiriert von jQuery



Donnerstag, 26. April 2012
HTML Library

          elem.attributes.contains('name');
          elem.attributes['name'];
          elem.attributes['name'] = 'value';
          elem.attributes.remove('name');

                                Collections!



Donnerstag, 26. April 2012
HTML Library
          new Element.tag('div');

          TableElement t = new Element.html(
          '<table><tr><td>Hi</td></tr></table>'
          );

                             Verbesserte Elementerstellung - mit
                                       Konstruktoren

Donnerstag, 26. April 2012
HTML Library

          elem.on.click.add(
              (event) => print('click!'));

          elem.on.click.remove(listener);



                 Alle Events sind in einem Property erreichbar.


Donnerstag, 26. April 2012
Templates
                                                App.dart




                      Hello.tmpl   Hello.dart




                                                App.html




Donnerstag, 26. April 2012
Templates

               template Hello(String to) {
                 <div>${to}</div>
               }



               $ template Hello


Donnerstag, 26. April 2012
Templates

      main() {
        Hello h = new Hello("Motörhead");
        var panel = document.query("#p");
        panel.elements.add(h.root);
      }




Donnerstag, 26. April 2012
And the winner is...




                           en
                         ed
                                  Offenheit
                                 Stabile API
                      hi
                   sc
                               Template System
                nt

                                  Releases
 ne


                                  Zukunft
                             Browserübergreifend
U




                               Android Support
                               Geschwindigkeit
                                 Lautstärke
Donnerstag, 26. April 2012
Röck ön!
                              Danke!

                               Christian Grobmeier
                             http://www.grobmeier.de
                                    @grobmeier



Donnerstag, 26. April 2012

Weitere ähnliche Inhalte

PDF
Zen Programming
PDF
World of Logging
PDF
The "Why Should You Talk" Talk
PDF
Go Mobile with Apache Cordova, Zagreb 2014
PDF
Apps with Apache Cordova and Phonegap
PPT
Dart und JavaScript
KEY
Dart != JavaScript
PDF
2024 Trend Updates: What Really Works In SEO & Content Marketing
Zen Programming
World of Logging
The "Why Should You Talk" Talk
Go Mobile with Apache Cordova, Zagreb 2014
Apps with Apache Cordova and Phonegap
Dart und JavaScript
Dart != JavaScript
2024 Trend Updates: What Really Works In SEO & Content Marketing
Anzeige

Dart @ JUG Saxony

  • 1. versus Christian Grobmeier http://www.grobmeier.de @grobmeier Donnerstag, 26. April 2012
  • 2. Programmiersprache • Heavy Metal Band aus von Google England • Kann JS ersetzen • Ersetzt Hawkwind • Läuft in einer VM • Läuft mit Whisky • Für „ernsthafte“ • Zur täglichen Anwendungen Anwendungen • Jung und rockt • Alt und rockt Donnerstag, 26. April 2012
  • 3. Band Lemmy Mikkey Dee Bass + Gesang Gitarre Wizzo Schlagzeug Donnerstag, 26. April 2012
  • 4. Band Dart Editor Dart SDK Dartium Donnerstag, 26. April 2012
  • 5. Releases Lang Spec v0.08 :-( kaum Libraries :-( 21 Studioalben! + unzähliges mehr Donnerstag, 26. April 2012
  • 6. Highlights + 17 mehr! Donnerstag, 26. April 2012
  • 7. Highlights Dart ist „Mainstream“, hat eine main-Methode und kennt nur ein null. Donnerstag, 26. April 2012
  • 8. Highlights Dart kennt Interfaces und Klassen Donnerstag, 26. April 2012
  • 9. Highlights class MyReceiver extends Isolate { } Einfachvererbung interface Hobbit extends A, B{ } Mehrvererbung class Frodo implements Hobbit, Hungry { } Donnerstag, 26. April 2012
  • 10. Highlights Dart kennt optionale Typen dart --enable_type_checks App.dart Donnerstag, 26. April 2012
  • 11. Highlights Dynamic class Frodo { var hungry; bool sleepy; Ring ring; } Donnerstag, 26. April 2012
  • 12. Highlights Dart does not need to drink whisky. It has whisky in it‘s veins. Donnerstag, 26. April 2012
  • 13. Highlights class Frodo { Frodo(num age) : super() { } } var frodo = new Frodo(111); Konstruktor Donnerstag, 26. April 2012
  • 14. Highlights class Frodo { Frodo.eat(){ } } var frodo = new Frodo.eat(); Ein „named Constructor“ verhält sich wie ein überladener Konstruktor in Java. Donnerstag, 26. April 2012
  • 15. Highlights class Frodo { var hungry; Frodo.cook(this.hungry); } new Frodo.cook(true); Donnerstag, 26. April 2012
  • 16. Highlights class Frodo { bool _hungry; bool get hungry() => _hungry; void set hungry(bool x) { _hungry = x; } } Get/Set kann nicht überschrieben werden und können nicht überschreiben. Donnerstag, 26. April 2012
  • 17. Highlights Frodo f = new Frodo(); f.hungry = true; Setter werden wie Standardproperties aufgerufen. GET/SET Methoden vermeiden! Donnerstag, 26. April 2012
  • 18. class Hobbit { Highlights factory Hobbit() { return new Hobbit._internal(); } Hobbit._internal() { print("Construct");! } } main() { Hobbit hobbit = new Hobbit(); } Das Factory Pattern mit Dart Donnerstag, 26. April 2012
  • 19. Highlights Dart ist Library-Scoped Donnerstag, 26. April 2012
  • 20. Highlights Privacy class Frodo { Public eat(){ } _sleep() { } } Private Donnerstag, 26. April 2012
  • 21. Highlights Privacy #library(„Frodo“); class Frodo {... Public #library(„Mordor“); #import(„Frodo.dart“); new Frodo()... Private Elemente sind nicht sichtbar Donnerstag, 26. April 2012
  • 22. Highlights Dart Isolates Donnerstag, 26. April 2012
  • 23. Threads => Isolates • Isolates erlauben „multithreading“ • Isolates kommunizieren via Ports • Isolates werden durch „spawn“ing erzeugt Donnerstag, 26. April 2012
  • 24. Isolates <body> <script type="application/dart"> main() { // Do some DART } Isolate </script> <script type="application/dart"> main() { } </script> </body> Donnerstag, 26. April 2012
  • 25. Isolates Light Heavy •Leben im gleichen Thread •Erzeugen einen neuen Thread •Nur ein Isolate auf einmal •Mehrere Isolates auf einmal Dart entscheidet über den Geschmack. Isolates können keine States teilen! Isolates sind immer asynchron! Donnerstag, 26. April 2012
  • 26. Isolates process() { port.receive((var m, SendPort r) { print ("Got message: ${m}"); r.send("close"); port.close(); }); } Donnerstag, 26. April 2012
  • 27. Isolates main() { port.receive((var m, SendPort r) { print("Got message: ${m}"); ! port.close(); }); ! SendPort s = spawnFunction(process); s.send("start", port.toSendPort()); } Donnerstag, 26. April 2012
  • 28. • Kein Multithreading - einmal Motörhead, immer Motörhead • Mit Motörhead ist man niemals einsam • Ist der eine Thread einmal beendet, gibt es keine neuen Alben mehr Donnerstag, 26. April 2012
  • 29. Road Crew • HTML • Templates • JSON • Dartdoc • Frog • etc. • We are the Road Crew • Unbekannte Personen Donnerstag, 26. April 2012
  • 30. HTML Library document.query('#myid'); document.query('.foo'); document.queryAll('.foo'); Inspiriert von jQuery Donnerstag, 26. April 2012
  • 31. HTML Library elem.attributes.contains('name'); elem.attributes['name']; elem.attributes['name'] = 'value'; elem.attributes.remove('name'); Collections! Donnerstag, 26. April 2012
  • 32. HTML Library new Element.tag('div'); TableElement t = new Element.html( '<table><tr><td>Hi</td></tr></table>' ); Verbesserte Elementerstellung - mit Konstruktoren Donnerstag, 26. April 2012
  • 33. HTML Library elem.on.click.add( (event) => print('click!')); elem.on.click.remove(listener); Alle Events sind in einem Property erreichbar. Donnerstag, 26. April 2012
  • 34. Templates App.dart Hello.tmpl Hello.dart App.html Donnerstag, 26. April 2012
  • 35. Templates template Hello(String to) { <div>${to}</div> } $ template Hello Donnerstag, 26. April 2012
  • 36. Templates main() { Hello h = new Hello("Motörhead"); var panel = document.query("#p"); panel.elements.add(h.root); } Donnerstag, 26. April 2012
  • 37. And the winner is... en ed Offenheit Stabile API hi sc Template System nt Releases ne Zukunft Browserübergreifend U Android Support Geschwindigkeit Lautstärke Donnerstag, 26. April 2012
  • 38. Röck ön! Danke! Christian Grobmeier http://www.grobmeier.de @grobmeier Donnerstag, 26. April 2012