SlideShare uma empresa Scribd logo
1 de 52
Building a Single-Page Web
    Application in Dart
      18h20 - 18h50 - Miles Davis B
Building a Single-Page Web
    Application in Dart




        Yohan Beschi
      So@t – Java Developer

       @yohanbeschi
                              27 au 29 mars 2013
Yohan Beschi
 • Started programming at 15 – 100% self-taught
 • Languages (Assembly, C/C++, Java, Python)
 • Blogger, Speaker, Instructor
 • Started Dart 6 months ago
Building Uis - Javascript ?
Building Uis - Java ?
Building Uis - But how ?
Programmatic Components with GWT
Java + GWT = Too verbose!




                                      lin es
                             n 1 00
                    e t ha
             M or
The Dart Way
 Table<User> table = new Table (sorting:true)
   ..addColumn('ID', new TextCell((User o) => o.id))
   ..addColumn('First name', new TextCell((User o) => o.firstName))
   ..addColumn('Last name', new TextCell((User o) => o.lastName))
   ..addColumn('Age', new TextCell((User o) => o.age))
   ..setData(objs);
The Dart Way
 Table<User> table = new Table (sorting:true)
   ..addColumn('ID', new TextCell((User o) => o.id))
   ..addColumn('First name', new TextCell((User o) => o.firstName))
   ..addColumn('Last name', new TextCell((User o) => o.lastName))
   ..addColumn('Age', new TextCell((User o) => o.age))
   ..setData(objs);




                             6lignes
Dart is the winner
Once upon a time…
Programmer productivity
Application scalability
Raw execution speed
Startup performance
And here we are!
 • Open Source (BSD)
 • Structured
 • Anti-revolutionary
 • Same goals as new Javascript frameworks
 • The goal is to not break the web
Dart - The language
Abstract Class
 abstract class Validatable {

 }
Abstract Method
 abstract class Validatable {
   List<Object> valuesToValidate();
 }
Generics
 abstract class Validator<T extends Validatable> {

 }
Implementing a method – 1/4
 abstract class Validator<T extends Validatable> {
   bool validate(T object) {

     }
 }
Implementing a method - for in – 2/4
 abstract class Validator<T extends Validatable> {
   bool validate(T object) {
     for (Object obj in object.valuesToValidate()) {

         }
     }
 }
Implementing a method – 3/4
 abstract class Validator<T extends Validatable> {
   bool validate(T object) {
     for (Object obj in object.valuesToValidate()) {
       if (StringUtils.isEmpty(obj.toString())) {

             }
         }
     }
 }
Implementing a method – 4/4
 abstract class Validator<T extends Validatable> {
   bool validate(T object) {
     for (Object obj in object.valuesToValidate()) {
       if (StringUtils.isEmpty(obj.toString())) {
         return false;
       }
     }

         return true;
     }
 }
Concrete class
 class User {

 }
Class as Interface
 class User implements Validatable {

 }
Class members
 class User implements Validatable {
   String username;
   String password;

 }
Private Class members
 class User implements Validatable {
   String _username;
   String _password;

 }
Accessors
 class User implements Validatable {
   String _username;
   String _password;

     String get username => this._username;
     String get password => this._password;
            set username(String username)
               => this._username = username;
            set password => this._password = password;
 }
Constructor – Sugar Syntax
 class User implements Validatable {
   String _username;
   String _password;

     User(String this._username, String this._password);
 }
Implementing an abstract method
 class User implements Validatable {
   String _username;
   String _password;

     User(String this._username, String this._password);

     List<Object> valuesToValidate() {
       return [_username, _password];
     }
 }
Dart Reference API
 •   Core            •   Unit Testing & Mocks
 •   HTML            •   Math

 •   Async           •   Logging

 •   IO              •   URI

 •   Crypto
                     •   I18N
                     •   etc.
 •   JSON
 •   Mirrors
 •   UTF
But there is more…
 • Mixins
 • Optionally typed
 • Top level functions
 • Mono process
Isolates
Dart Ecosystem
Virtual Machines
Dartium
DartEditor
Plugins
dart2js
dart2js
dart2js
 • Target HTML5
 • Tree Shaking
 • Aggregation/Minification
 • Optimization
Pub
Pub - pubspec.yaml
 name: pacifista_rocks
 description: The best application in the whole world
 version: 0.0.1
 dependencies:
    great_lib: any
dartdoc
 /// This is a single-line documentation comment.

 /**
  * This is a multi-line documentation comment.
  * To generate the documentation:
  * $ dartdoc <filename>
  */
 void main() {

 }
dartdoc
Uses
 • Single-page Web Apps
 • Client and server side applications
 • HTML Games
Démonstration




https://github.com/yohanbeschi/devoxxfr_20130327.dart

    https://github.com/yohanbeschi/pwt_proto.dart
                                                        27 au 29 mars 2013
Roadmap

Today: M3   ??: M4   Summer 2013 : V1 !
Want to know more ?
 •   DartLangFR
     •   Mailing-list : dartlangfr (https://groups.google.com/forum/?fromgroups=&hl=en#!forum/dartlangfr)
     •   Google+ : DartlangFR (https://plus.google.com/u/0/communities/104813951711720144450)
     •   Twitter : @dartlang_fr
     •   Blog : dartlangfr.net


 •   DartLang
     •   Site officiel : www.dartlang.org
     •   Mailing-list : dartlang (https://groups.google.com/a/dartlang.org/forum/?fromgroups&hl=en#!forum/misc)
     •   Google+ : Dart (https://plus.google.com/+dartlang)
     •   Google+ : Dartisans (https://plus.google.com/communities/114566943291919232850)
     •   Twitter : @dart_lang
     •   Blog : blog.dartwatch.com
     •   Newsletter : Dart weekly
Thanks




         Questions ?

Mais conteúdo relacionado

Semelhante a Building a Single-Page Web App in Dart

Golang slidesaudrey
Golang slidesaudreyGolang slidesaudrey
Golang slidesaudreyAudrey Lim
 
More on Fitnesse and Continuous Integration (Silicon Valley code camp 2012)
More on Fitnesse and Continuous Integration (Silicon Valley code camp 2012)More on Fitnesse and Continuous Integration (Silicon Valley code camp 2012)
More on Fitnesse and Continuous Integration (Silicon Valley code camp 2012)Jen Wong
 
Intro To JavaScript Unit Testing - Ran Mizrahi
Intro To JavaScript Unit Testing - Ran MizrahiIntro To JavaScript Unit Testing - Ran Mizrahi
Intro To JavaScript Unit Testing - Ran MizrahiRan Mizrahi
 
Breaking down data silos with the open data protocol
Breaking down data silos with the open data protocolBreaking down data silos with the open data protocol
Breaking down data silos with the open data protocolWoodruff Solutions LLC
 
Lecture 03 - JQuery.pdf
Lecture 03 - JQuery.pdfLecture 03 - JQuery.pdf
Lecture 03 - JQuery.pdfLê Thưởng
 
Explain Classes and methods in java (ch04).ppt
Explain Classes and methods in java (ch04).pptExplain Classes and methods in java (ch04).ppt
Explain Classes and methods in java (ch04).pptayaankim007
 
Building a friendly .NET SDK to connect to Space
Building a friendly .NET SDK to connect to SpaceBuilding a friendly .NET SDK to connect to Space
Building a friendly .NET SDK to connect to SpaceMaarten Balliauw
 
Venturing Into The Wild: A .NET Developer's Experience As A Ruby Developer
Venturing Into The Wild: A .NET Developer's Experience As A Ruby DeveloperVenturing Into The Wild: A .NET Developer's Experience As A Ruby Developer
Venturing Into The Wild: A .NET Developer's Experience As A Ruby DeveloperJon Kruger
 
Android Automated Testing
Android Automated TestingAndroid Automated Testing
Android Automated Testingroisagiv
 
9781439035665 ppt ch08
9781439035665 ppt ch089781439035665 ppt ch08
9781439035665 ppt ch08Terry Yoast
 
Core java complete ppt(note)
Core java  complete  ppt(note)Core java  complete  ppt(note)
Core java complete ppt(note)arvind pandey
 
Java → kotlin: Tests Made Simple
Java → kotlin: Tests Made SimpleJava → kotlin: Tests Made Simple
Java → kotlin: Tests Made Simpleleonsabr
 
Bring the fun back to java
Bring the fun back to javaBring the fun back to java
Bring the fun back to javaciklum_ods
 

Semelhante a Building a Single-Page Web App in Dart (20)

C Sharp Course 101.5
C Sharp Course 101.5C Sharp Course 101.5
C Sharp Course 101.5
 
Golang slidesaudrey
Golang slidesaudreyGolang slidesaudrey
Golang slidesaudrey
 
More on Fitnesse and Continuous Integration (Silicon Valley code camp 2012)
More on Fitnesse and Continuous Integration (Silicon Valley code camp 2012)More on Fitnesse and Continuous Integration (Silicon Valley code camp 2012)
More on Fitnesse and Continuous Integration (Silicon Valley code camp 2012)
 
Intro To JavaScript Unit Testing - Ran Mizrahi
Intro To JavaScript Unit Testing - Ran MizrahiIntro To JavaScript Unit Testing - Ran Mizrahi
Intro To JavaScript Unit Testing - Ran Mizrahi
 
Breaking down data silos with the open data protocol
Breaking down data silos with the open data protocolBreaking down data silos with the open data protocol
Breaking down data silos with the open data protocol
 
Lecture 03 - JQuery.pdf
Lecture 03 - JQuery.pdfLecture 03 - JQuery.pdf
Lecture 03 - JQuery.pdf
 
Explain Classes and methods in java (ch04).ppt
Explain Classes and methods in java (ch04).pptExplain Classes and methods in java (ch04).ppt
Explain Classes and methods in java (ch04).ppt
 
Building a friendly .NET SDK to connect to Space
Building a friendly .NET SDK to connect to SpaceBuilding a friendly .NET SDK to connect to Space
Building a friendly .NET SDK to connect to Space
 
Java for beginners
Java for beginnersJava for beginners
Java for beginners
 
Ruby Programming Assignment Help
Ruby Programming Assignment HelpRuby Programming Assignment Help
Ruby Programming Assignment Help
 
Ruby Programming Assignment Help
Ruby Programming Assignment HelpRuby Programming Assignment Help
Ruby Programming Assignment Help
 
Venturing Into The Wild: A .NET Developer's Experience As A Ruby Developer
Venturing Into The Wild: A .NET Developer's Experience As A Ruby DeveloperVenturing Into The Wild: A .NET Developer's Experience As A Ruby Developer
Venturing Into The Wild: A .NET Developer's Experience As A Ruby Developer
 
Android Automated Testing
Android Automated TestingAndroid Automated Testing
Android Automated Testing
 
Structure on a freeform world
Structure on a freeform worldStructure on a freeform world
Structure on a freeform world
 
Os Secoske
Os SecoskeOs Secoske
Os Secoske
 
9781439035665 ppt ch08
9781439035665 ppt ch089781439035665 ppt ch08
9781439035665 ppt ch08
 
Scala introduction
Scala introductionScala introduction
Scala introduction
 
Core java complete ppt(note)
Core java  complete  ppt(note)Core java  complete  ppt(note)
Core java complete ppt(note)
 
Java → kotlin: Tests Made Simple
Java → kotlin: Tests Made SimpleJava → kotlin: Tests Made Simple
Java → kotlin: Tests Made Simple
 
Bring the fun back to java
Bring the fun back to javaBring the fun back to java
Bring the fun back to java
 

Mais de yohanbeschi

VoxxedDays LU 2016 - Thoughtworks Go - Continuous Deployment made easy and free
VoxxedDays LU 2016 - Thoughtworks Go - Continuous Deployment made easy and freeVoxxedDays LU 2016 - Thoughtworks Go - Continuous Deployment made easy and free
VoxxedDays LU 2016 - Thoughtworks Go - Continuous Deployment made easy and freeyohanbeschi
 
Java 8 - Nuts and Bold - SFEIR Benelux
Java 8 - Nuts and Bold - SFEIR BeneluxJava 8 - Nuts and Bold - SFEIR Benelux
Java 8 - Nuts and Bold - SFEIR Beneluxyohanbeschi
 
JVM Hardcore - Part 18 - Converting a logical expression into bytecode
JVM Hardcore - Part 18 - Converting a logical expression into bytecodeJVM Hardcore - Part 18 - Converting a logical expression into bytecode
JVM Hardcore - Part 18 - Converting a logical expression into bytecodeyohanbeschi
 
JVM Hardcore - Part 07 - Parsing (Productions stack states)
JVM Hardcore - Part 07 - Parsing (Productions stack states)JVM Hardcore - Part 07 - Parsing (Productions stack states)
JVM Hardcore - Part 07 - Parsing (Productions stack states)yohanbeschi
 
Introduction to the Java bytecode - So@t - 20130924
Introduction to the Java bytecode - So@t - 20130924Introduction to the Java bytecode - So@t - 20130924
Introduction to the Java bytecode - So@t - 20130924yohanbeschi
 
JVM Hardcode - Part 01 - How Frames work
JVM Hardcode - Part 01 - How Frames workJVM Hardcode - Part 01 - How Frames work
JVM Hardcode - Part 01 - How Frames workyohanbeschi
 
Introduction to dart - So@t - 20130410
Introduction to dart - So@t - 20130410Introduction to dart - So@t - 20130410
Introduction to dart - So@t - 20130410yohanbeschi
 
Dart - web_ui & Programmatic components - Paris JUG - 20130409
Dart - web_ui & Programmatic components - Paris JUG - 20130409Dart - web_ui & Programmatic components - Paris JUG - 20130409
Dart - web_ui & Programmatic components - Paris JUG - 20130409yohanbeschi
 
Introduction à dart
Introduction à dartIntroduction à dart
Introduction à dartyohanbeschi
 

Mais de yohanbeschi (9)

VoxxedDays LU 2016 - Thoughtworks Go - Continuous Deployment made easy and free
VoxxedDays LU 2016 - Thoughtworks Go - Continuous Deployment made easy and freeVoxxedDays LU 2016 - Thoughtworks Go - Continuous Deployment made easy and free
VoxxedDays LU 2016 - Thoughtworks Go - Continuous Deployment made easy and free
 
Java 8 - Nuts and Bold - SFEIR Benelux
Java 8 - Nuts and Bold - SFEIR BeneluxJava 8 - Nuts and Bold - SFEIR Benelux
Java 8 - Nuts and Bold - SFEIR Benelux
 
JVM Hardcore - Part 18 - Converting a logical expression into bytecode
JVM Hardcore - Part 18 - Converting a logical expression into bytecodeJVM Hardcore - Part 18 - Converting a logical expression into bytecode
JVM Hardcore - Part 18 - Converting a logical expression into bytecode
 
JVM Hardcore - Part 07 - Parsing (Productions stack states)
JVM Hardcore - Part 07 - Parsing (Productions stack states)JVM Hardcore - Part 07 - Parsing (Productions stack states)
JVM Hardcore - Part 07 - Parsing (Productions stack states)
 
Introduction to the Java bytecode - So@t - 20130924
Introduction to the Java bytecode - So@t - 20130924Introduction to the Java bytecode - So@t - 20130924
Introduction to the Java bytecode - So@t - 20130924
 
JVM Hardcode - Part 01 - How Frames work
JVM Hardcode - Part 01 - How Frames workJVM Hardcode - Part 01 - How Frames work
JVM Hardcode - Part 01 - How Frames work
 
Introduction to dart - So@t - 20130410
Introduction to dart - So@t - 20130410Introduction to dart - So@t - 20130410
Introduction to dart - So@t - 20130410
 
Dart - web_ui & Programmatic components - Paris JUG - 20130409
Dart - web_ui & Programmatic components - Paris JUG - 20130409Dart - web_ui & Programmatic components - Paris JUG - 20130409
Dart - web_ui & Programmatic components - Paris JUG - 20130409
 
Introduction à dart
Introduction à dartIntroduction à dart
Introduction à dart
 

Último

Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
MENTAL STATUS EXAMINATION format.docx
MENTAL     STATUS EXAMINATION format.docxMENTAL     STATUS EXAMINATION format.docx
MENTAL STATUS EXAMINATION format.docxPoojaSen20
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAssociation for Project Management
 
PSYCHIATRIC History collection FORMAT.pptx
PSYCHIATRIC   History collection FORMAT.pptxPSYCHIATRIC   History collection FORMAT.pptx
PSYCHIATRIC History collection FORMAT.pptxPoojaSen20
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfchloefrazer622
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionSafetyChain Software
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsanshu789521
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3JemimahLaneBuaron
 

Último (20)

Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
MENTAL STATUS EXAMINATION format.docx
MENTAL     STATUS EXAMINATION format.docxMENTAL     STATUS EXAMINATION format.docx
MENTAL STATUS EXAMINATION format.docx
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 
PSYCHIATRIC History collection FORMAT.pptx
PSYCHIATRIC   History collection FORMAT.pptxPSYCHIATRIC   History collection FORMAT.pptx
PSYCHIATRIC History collection FORMAT.pptx
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdf
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory Inspection
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha elections
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
Staff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSDStaff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSD
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 

Building a Single-Page Web App in Dart

  • 1. Building a Single-Page Web Application in Dart 18h20 - 18h50 - Miles Davis B
  • 2. Building a Single-Page Web Application in Dart Yohan Beschi So@t – Java Developer @yohanbeschi 27 au 29 mars 2013
  • 3. Yohan Beschi • Started programming at 15 – 100% self-taught • Languages (Assembly, C/C++, Java, Python) • Blogger, Speaker, Instructor • Started Dart 6 months ago
  • 4. Building Uis - Javascript ?
  • 5. Building Uis - Java ?
  • 6. Building Uis - But how ?
  • 8. Java + GWT = Too verbose! lin es n 1 00 e t ha M or
  • 9. The Dart Way Table<User> table = new Table (sorting:true) ..addColumn('ID', new TextCell((User o) => o.id)) ..addColumn('First name', new TextCell((User o) => o.firstName)) ..addColumn('Last name', new TextCell((User o) => o.lastName)) ..addColumn('Age', new TextCell((User o) => o.age)) ..setData(objs);
  • 10. The Dart Way Table<User> table = new Table (sorting:true) ..addColumn('ID', new TextCell((User o) => o.id)) ..addColumn('First name', new TextCell((User o) => o.firstName)) ..addColumn('Last name', new TextCell((User o) => o.lastName)) ..addColumn('Age', new TextCell((User o) => o.age)) ..setData(objs); 6lignes
  • 11. Dart is the winner
  • 12. Once upon a time…
  • 17. And here we are! • Open Source (BSD) • Structured • Anti-revolutionary • Same goals as new Javascript frameworks • The goal is to not break the web
  • 18. Dart - The language
  • 19. Abstract Class abstract class Validatable { }
  • 20. Abstract Method abstract class Validatable { List<Object> valuesToValidate(); }
  • 21. Generics abstract class Validator<T extends Validatable> { }
  • 22. Implementing a method – 1/4 abstract class Validator<T extends Validatable> { bool validate(T object) { } }
  • 23. Implementing a method - for in – 2/4 abstract class Validator<T extends Validatable> { bool validate(T object) { for (Object obj in object.valuesToValidate()) { } } }
  • 24. Implementing a method – 3/4 abstract class Validator<T extends Validatable> { bool validate(T object) { for (Object obj in object.valuesToValidate()) { if (StringUtils.isEmpty(obj.toString())) { } } } }
  • 25. Implementing a method – 4/4 abstract class Validator<T extends Validatable> { bool validate(T object) { for (Object obj in object.valuesToValidate()) { if (StringUtils.isEmpty(obj.toString())) { return false; } } return true; } }
  • 27. Class as Interface class User implements Validatable { }
  • 28. Class members class User implements Validatable { String username; String password; }
  • 29. Private Class members class User implements Validatable { String _username; String _password; }
  • 30. Accessors class User implements Validatable { String _username; String _password; String get username => this._username; String get password => this._password; set username(String username) => this._username = username; set password => this._password = password; }
  • 31. Constructor – Sugar Syntax class User implements Validatable { String _username; String _password; User(String this._username, String this._password); }
  • 32. Implementing an abstract method class User implements Validatable { String _username; String _password; User(String this._username, String this._password); List<Object> valuesToValidate() { return [_username, _password]; } }
  • 33. Dart Reference API • Core • Unit Testing & Mocks • HTML • Math • Async • Logging • IO • URI • Crypto • I18N • etc. • JSON • Mirrors • UTF
  • 34. But there is more… • Mixins • Optionally typed • Top level functions • Mono process
  • 43. dart2js • Target HTML5 • Tree Shaking • Aggregation/Minification • Optimization
  • 44. Pub
  • 45. Pub - pubspec.yaml name: pacifista_rocks description: The best application in the whole world version: 0.0.1 dependencies: great_lib: any
  • 46. dartdoc /// This is a single-line documentation comment. /** * This is a multi-line documentation comment. * To generate the documentation: * $ dartdoc <filename> */ void main() { }
  • 48. Uses • Single-page Web Apps • Client and server side applications • HTML Games
  • 49. Démonstration https://github.com/yohanbeschi/devoxxfr_20130327.dart https://github.com/yohanbeschi/pwt_proto.dart 27 au 29 mars 2013
  • 50. Roadmap Today: M3 ??: M4 Summer 2013 : V1 !
  • 51. Want to know more ? • DartLangFR • Mailing-list : dartlangfr (https://groups.google.com/forum/?fromgroups=&hl=en#!forum/dartlangfr) • Google+ : DartlangFR (https://plus.google.com/u/0/communities/104813951711720144450) • Twitter : @dartlang_fr • Blog : dartlangfr.net • DartLang • Site officiel : www.dartlang.org • Mailing-list : dartlang (https://groups.google.com/a/dartlang.org/forum/?fromgroups&hl=en#!forum/misc) • Google+ : Dart (https://plus.google.com/+dartlang) • Google+ : Dartisans (https://plus.google.com/communities/114566943291919232850) • Twitter : @dart_lang • Blog : blog.dartwatch.com • Newsletter : Dart weekly
  • 52. Thanks Questions ?