SlideShare uma empresa Scribd logo
1 de 44
DART
             Yohan BESCHI – Développeur Java
                      @yohanbeschi
                      +Yohan Beschi
2013-02-13                 Introduction à DART   1
Pourquoi ce talk ?
CellTable<User> table = new CellTable<User>();                                                                }
                                                                                                            });
TextColumn<User> idColumn = new TextColumn<User>() {                                         columnSortHandler.setComparator(firstNameColumn,
  @Override                                                                                                 new Comparator<Tester.User>() {
  public String getValue(User user) {                                                                         public int compare(User o1, User o2) {
               return user.id;                                                                                             if (o1 == o2) {
  }                                                                                                                          return 0;
};                                                                                                                         }

TextColumn<User> firstNameColumn = new TextColumn<User>() {                                                                if (o1 != null) {
  @Override                                                                                                                  return (o2 != null) ? o1.firstName.compareTo(o2.firstName) : 1;
  public String getValue(User user) {                                                                                      }
               return user.firstName;                                                                                      return -1;
  }                                                                                                           }
};                                                                                                          });
                                                                                             columnSortHandler.setComparator(lasteNameColumn,
TextColumn<User> lastNameColumn = new TextColumn<User>() {                                                  new Comparator<Tester.User>() {
  @Override                                                                                                   public int compare(User o1, User o2) {
  public String getValue(User user) {                                                                                      if (o1 == o2) {
               return user.lastName;                                                                                         return 0;
  }                                                                                                                        }
};
                                                                                                                           if (o1 != null) {
TextColumn<User> ageColumn = new TextColumn<User>() {                                                                        return (o2 != null) ? o1.lasteName.compareTo(o2.lasteName) : 1;
  @Override                                                                                                                }
  public String getValue(User user) {                                                                                      return -1;
               return user.age;                                                                               }
  }                                                                                                         });
};                                                                                           columnSortHandler.setComparator(ageColumn,
                                                                                                            new Comparator<Tester.User>() {
idColumn.setSortable(true);                                                                                   public int compare(User o1, User o2) {
firstNameColumn.setSortable(true);                                                                                         if (o1 == o2) {
lastNameColumn.setSortable(true);                                                                                            return 0;
ageColumn.setSortable(true);                                                                                               }

table.addColumn(idColumn, "ID");                                                                                           if (o1 != null) {
table.addColumn(firstNameColumn, "First name");                                                                              return (o2 != null) ? o1.age.compareTo(o2.age) : 1;
table.addColumn(lastNameColumn, "Lats name");                                                                              }
table.addColumn(ageColumn, "Age");                                                                                         return -1;
                                                                                                              }
ListDataProvider<User> dataProvider = new ListDataProvider<User>();                                         });
dataProvider.addDataDisplay(table);                                                          table.addColumnSortHandler(columnSortHandler);
                                                                                             table.getColumnSortList().push(firstNameColumn);
List<User> list = dataProvider.getList();
for (User user : USERS) {
  list.add(user);
}

ListHandler<User> columnSortHandler = new ListHandler<Tester.User>(list);
columnSortHandler.setComparator(idColumn,
               new Comparator<Tester.User>() {
                 public int compare(User o1, User o2) {
                              if (o1 == o2) {
                                return 0;
                              }

                              if (o1 != null) {
                                return (o2 != null) ? o1.id.compareTo(o2.id) : 1;
                              }
                              return -1;




2013-02-13                                                                          Introduction à DART                                                                                        2
Pourquoi ce talk ?
CellTable<User> table = new CellTable<User>();                                                                }
                                                                                                            });
TextColumn<User> idColumn = new TextColumn<User>() {                                         columnSortHandler.setComparator(firstNameColumn,
  @Override                                                                                                 new Comparator<Tester.User>() {
  public String getValue(User user) {                                                                         public int compare(User o1, User o2) {
               return user.id;                                                                                             if (o1 == o2) {
  }                                                                                                                          return 0;
};                                                                                                                         }

TextColumn<User> firstNameColumn = new TextColumn<User>() {                                                                if (o1 != null) {
  @Override                                                                                                                  return (o2 != null) ? o1.firstName.compareTo(o2.firstName) : 1;
  public String getValue(User user) {                                                                                      }
               return user.firstName;                                                                                      return -1;
  }                                                                                                           }
};                                                                                                          });
                                                                                             columnSortHandler.setComparator(lasteNameColumn,
TextColumn<User> lastNameColumn = new TextColumn<User>() {                                                  new Comparator<Tester.User>() {
  @Override                                                                                                   public int compare(User o1, User o2) {
  public String getValue(User user) {                                                                                      if (o1 == o2) {
               return user.lastName;                                                                                         return 0;
  }                                                                                                                        }
};
                                                                                                                           if (o1 != null) {
TextColumn<User> ageColumn = new TextColumn<User>() {                                                                        return (o2 != null) ? o1.lasteName.compareTo(o2.lasteName) : 1;
  @Override                                                                                                                }
  public String getValue(User user) {                                                                                      return -1;
               return user.age;                                                                               }
  }                                                                                                         });
};                                                                                           columnSortHandler.setComparator(ageColumn,
                                                                                                            new Comparator<Tester.User>() {
idColumn.setSortable(true);                                                                                   public int compare(User o1, User o2) {
firstNameColumn.setSortable(true);                                                                                         if (o1 == o2) {
lastNameColumn.setSortable(true);                                                                                            return 0;
ageColumn.setSortable(true);                                                                                               }

table.addColumn(idColumn, "ID");                                                                                           if (o1 != null) {
table.addColumn(firstNameColumn, "First name");                                                                              return (o2 != null) ? o1.age.compareTo(o2.age) : 1;
table.addColumn(lastNameColumn, "Lats name");                                                                              }
table.addColumn(ageColumn, "Age");                                                                                         return -1;
                                                                                                              }
ListDataProvider<User> dataProvider = new ListDataProvider<User>();                                         });
dataProvider.addDataDisplay(table);                                                          table.addColumnSortHandler(columnSortHandler);
                                                                                             table.getColumnSortList().push(firstNameColumn);
List<User> list = dataProvider.getList();
for (User user : USERS) {
  list.add(user);
}

ListHandler<User> columnSortHandler = new ListHandler<Tester.User>(list);
columnSortHandler.setComparator(idColumn,
               new Comparator<Tester.User>() {
                 public int compare(User o1, User o2) {
                              if (o1 == o2) {
                                return 0;
                              }

                              if (o1 != null) {
                                return (o2 != null) ? o1.id.compareTo(o2.id) : 1;
                              }
                              return -1;




2013-02-13                                                                          Introduction à DART                                                                                        3
Pourquoi ce talk ?
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);




2013-02-13                     Introduction à DART                   4
Pourquoi ce talk ?
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);




                       6 lignes

2013-02-13                     Introduction à DART                   5
Le gagnant pour moi ?




2013-02-13              Introduction à DART   6
Il était une fois…




2013-02-13                Introduction à DART   7
Productivité du programmeur




2013-02-13              Introduction à DART   8
Application évolutive




2013-02-13               Introduction à DART   9
Rapidité d'exécution




2013-02-13               Introduction à DART   10
Performance au démarrage




2013-02-13              Introduction à DART   11
L'arrivée de DART

⦿ Open Source (BSD)
⦿ Structuré
⦿ Anti-Révolutionnaire
⦿ Dans la mouvance des frameworks JS
⦿ N’a pas pour objectif de casser le web




2013-02-13               Introduction à DART   12
Classes abstraites

abstract class Validatable {

}




2013-02-13              Introduction à DART   13
Classes abstraites

abstract class Validatable {
 List<Object> valuesToValidate();
}




2013-02-13              Introduction à DART   14
Classes abstraites

abstract class Validator<T extends Validatable> {

}




2013-02-13              Introduction à DART         15
Classes abstraites

abstract class Validator<T extends Validatable> {
  bool validate(T object) {

     }
}




2013-02-13              Introduction à DART         16
Classes abstraites

abstract class Validator<T extends Validatable> {
  bool validate(T object) {
    for (Object obj in object.valuesToValidate()) {

             }
     }
}




2013-02-13                  Introduction à DART       17
Classes abstraites

abstract class Validator<T extends Validatable> {
  bool validate(T object) {
    for (Object obj in object.valuesToValidate()) {
      if (StringUtils.isEmpty(obj.toString())) {

                 }
             }
     }
}




2013-02-13                      Introduction à DART   18
Classes abstraites

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;
     }
}



2013-02-13                  Introduction à DART       19
Classes concrètes

class User {

}




2013-02-13              Introduction à DART   20
Classes concrètes

class User implements Validatable {

}




2013-02-13              Introduction à DART   21
Classes concrètes

class User implements Validatable {
  String username;
  String password;

}




2013-02-13              Introduction à DART   22
Classes concrètes

class User implements Validatable {
  String username;
  String password;

     User(this.username, this.password);

}




2013-02-13                Introduction à DART   23
Classes concrètes

class User implements Validatable {
  String username;
  String password;

     User(this.username, this.password);

     List<Object> valuesToValidate() {
       return [username, password];
     }
}




2013-02-13                Introduction à DART   24
Mais ce n’est pas tout

⦿ Mixins
⦿ Optionnellement typé
⦿ Gouverné par des fonctions de haut niveau
⦿ Mono processus




2013-02-13               Introduction à DART   25
Librairies disponibles

⦿ Core                             ⦿ TU et Mocks
⦿ HTML                             ⦿ Math
⦿ Async                            ⦿ Logging
⦿ IO                               ⦿ URI
⦿ Crypto                           ⦿ I18N
⦿ JSON                             ⦿ etc.
⦿ Mirrors
⦿ UTF

2013-02-13                Introduction à DART      26
Futures / Callback Hell - JS
getWinningNumber( (int result1) {
  updateResult(1, result1);
  getWinningNumber( (int result2) {
    updateResult(2, result2);
    getWinningNumber( (int result3) {
      updateResult(3, result3);
      getWinningNumber( (int result4) {
        updateResult(4, result4);
        getWinningNumber( (int result5) {
          updateResult(5, result5);
          getWinningNumber( (int result6) {
            updateResult(6, result6);
              //snip getResultsString()
          });
        });
      });
    });
  });
});
2013-02-13                     Introduction à DART   27
Futures / Callback Hell - Dart
void main() {
  getFutureWinningNumber()
    .then(next(1))
    .then(next(2))
    .then(next(3))
    .then(next(4))
    .then(next(5))
    .then(next(6));
}

Function next(int position) {
  return (int result) {
     updateResult(position, result);
     return getFutureWinningNumber();
  };
}


2013-02-13                     Introduction à DART   28
Isolates




2013-02-13              Introduction à DART   29
Machines Virtuelles




2013-02-13               Introduction à DART   30
Dartium




2013-02-13             Introduction à DART   31
DartEditor




2013-02-13                Introduction à DART   32
Plugins




2013-02-13             Introduction à DART   33
dart2js




2013-02-13             Introduction à DART   34
dart2js




2013-02-13             Introduction à DART   35
dart2js

⦿ Cible HTML5
⦿ Tree Shaking
⦿ Agrégation/Minification
⦿ Optimisation




2013-02-13             Introduction à DART   36
pub




2013-02-13         Introduction à DART   37
pub

pubspec.yaml
name: pacifista_rocks
description: The best application in the whole world
version: 0.0.1
dependencies:
   great_lib: any




2013-02-13                Introduction à DART          38
dartdoc

/// This is a single-line documentation comment.

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

}




2013-02-13                Introduction à DART      39
dartdoc




2013-02-13             Introduction à DART   40
Utilisation

⦿ Création de sites Single-Page
⦿ Création d'application complètes
⦿ Jeux HTML




2013-02-13                 Introduction à DART   41
Roadmap


Aujourd'hui : M2 Mi-fevrier : M3                         Été : V1 !




 2013-02-13                        Introduction à DART                42
Aller plus loin
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


2013-02-13                                            Introduction à DART                                       43
Des questions ?

2013-02-13       Introduction à DART   44

Mais conteúdo relacionado

Semelhante a Introduction à dart

Scala 2013 review
Scala 2013 reviewScala 2013 review
Scala 2013 review
Sagie Davidovich
 
20070329 Java Programing Tips
20070329 Java Programing Tips20070329 Java Programing Tips
20070329 Java Programing Tips
Shingo Furuyama
 

Semelhante a Introduction à dart (7)

Introduction to dart par Yohan Beschi
Introduction to dart par Yohan BeschiIntroduction to dart par Yohan Beschi
Introduction to dart par Yohan Beschi
 
Introduction à Dart
Introduction à DartIntroduction à Dart
Introduction à Dart
 
Scala 2013 review
Scala 2013 reviewScala 2013 review
Scala 2013 review
 
JUnit PowerUp
JUnit PowerUpJUnit PowerUp
JUnit PowerUp
 
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
 
Spring and dependency injection
Spring and dependency injectionSpring and dependency injection
Spring and dependency injection
 
20070329 Java Programing Tips
20070329 Java Programing Tips20070329 Java Programing Tips
20070329 Java Programing Tips
 

Mais de yohanbeschi (6)

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
 
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
 
Building Single-Page Web Appplications in dart - Devoxx France 2013
Building Single-Page Web Appplications in dart - Devoxx France 2013Building Single-Page Web Appplications in dart - Devoxx France 2013
Building Single-Page Web Appplications in dart - Devoxx France 2013
 

Último

1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
QucHHunhnh
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
negromaestrong
 
Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdf
Chris Hunter
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
QucHHunhnh
 

Último (20)

Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docx
 
Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdf
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writing
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
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
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 

Introduction à dart

  • 1. DART Yohan BESCHI – Développeur Java @yohanbeschi +Yohan Beschi 2013-02-13 Introduction à DART 1
  • 2. Pourquoi ce talk ? CellTable<User> table = new CellTable<User>(); } }); TextColumn<User> idColumn = new TextColumn<User>() { columnSortHandler.setComparator(firstNameColumn, @Override new Comparator<Tester.User>() { public String getValue(User user) { public int compare(User o1, User o2) { return user.id; if (o1 == o2) { } return 0; }; } TextColumn<User> firstNameColumn = new TextColumn<User>() { if (o1 != null) { @Override return (o2 != null) ? o1.firstName.compareTo(o2.firstName) : 1; public String getValue(User user) { } return user.firstName; return -1; } } }; }); columnSortHandler.setComparator(lasteNameColumn, TextColumn<User> lastNameColumn = new TextColumn<User>() { new Comparator<Tester.User>() { @Override public int compare(User o1, User o2) { public String getValue(User user) { if (o1 == o2) { return user.lastName; return 0; } } }; if (o1 != null) { TextColumn<User> ageColumn = new TextColumn<User>() { return (o2 != null) ? o1.lasteName.compareTo(o2.lasteName) : 1; @Override } public String getValue(User user) { return -1; return user.age; } } }); }; columnSortHandler.setComparator(ageColumn, new Comparator<Tester.User>() { idColumn.setSortable(true); public int compare(User o1, User o2) { firstNameColumn.setSortable(true); if (o1 == o2) { lastNameColumn.setSortable(true); return 0; ageColumn.setSortable(true); } table.addColumn(idColumn, "ID"); if (o1 != null) { table.addColumn(firstNameColumn, "First name"); return (o2 != null) ? o1.age.compareTo(o2.age) : 1; table.addColumn(lastNameColumn, "Lats name"); } table.addColumn(ageColumn, "Age"); return -1; } ListDataProvider<User> dataProvider = new ListDataProvider<User>(); }); dataProvider.addDataDisplay(table); table.addColumnSortHandler(columnSortHandler); table.getColumnSortList().push(firstNameColumn); List<User> list = dataProvider.getList(); for (User user : USERS) { list.add(user); } ListHandler<User> columnSortHandler = new ListHandler<Tester.User>(list); columnSortHandler.setComparator(idColumn, new Comparator<Tester.User>() { public int compare(User o1, User o2) { if (o1 == o2) { return 0; } if (o1 != null) { return (o2 != null) ? o1.id.compareTo(o2.id) : 1; } return -1; 2013-02-13 Introduction à DART 2
  • 3. Pourquoi ce talk ? CellTable<User> table = new CellTable<User>(); } }); TextColumn<User> idColumn = new TextColumn<User>() { columnSortHandler.setComparator(firstNameColumn, @Override new Comparator<Tester.User>() { public String getValue(User user) { public int compare(User o1, User o2) { return user.id; if (o1 == o2) { } return 0; }; } TextColumn<User> firstNameColumn = new TextColumn<User>() { if (o1 != null) { @Override return (o2 != null) ? o1.firstName.compareTo(o2.firstName) : 1; public String getValue(User user) { } return user.firstName; return -1; } } }; }); columnSortHandler.setComparator(lasteNameColumn, TextColumn<User> lastNameColumn = new TextColumn<User>() { new Comparator<Tester.User>() { @Override public int compare(User o1, User o2) { public String getValue(User user) { if (o1 == o2) { return user.lastName; return 0; } } }; if (o1 != null) { TextColumn<User> ageColumn = new TextColumn<User>() { return (o2 != null) ? o1.lasteName.compareTo(o2.lasteName) : 1; @Override } public String getValue(User user) { return -1; return user.age; } } }); }; columnSortHandler.setComparator(ageColumn, new Comparator<Tester.User>() { idColumn.setSortable(true); public int compare(User o1, User o2) { firstNameColumn.setSortable(true); if (o1 == o2) { lastNameColumn.setSortable(true); return 0; ageColumn.setSortable(true); } table.addColumn(idColumn, "ID"); if (o1 != null) { table.addColumn(firstNameColumn, "First name"); return (o2 != null) ? o1.age.compareTo(o2.age) : 1; table.addColumn(lastNameColumn, "Lats name"); } table.addColumn(ageColumn, "Age"); return -1; } ListDataProvider<User> dataProvider = new ListDataProvider<User>(); }); dataProvider.addDataDisplay(table); table.addColumnSortHandler(columnSortHandler); table.getColumnSortList().push(firstNameColumn); List<User> list = dataProvider.getList(); for (User user : USERS) { list.add(user); } ListHandler<User> columnSortHandler = new ListHandler<Tester.User>(list); columnSortHandler.setComparator(idColumn, new Comparator<Tester.User>() { public int compare(User o1, User o2) { if (o1 == o2) { return 0; } if (o1 != null) { return (o2 != null) ? o1.id.compareTo(o2.id) : 1; } return -1; 2013-02-13 Introduction à DART 3
  • 4. Pourquoi ce talk ? 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); 2013-02-13 Introduction à DART 4
  • 5. Pourquoi ce talk ? 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); 6 lignes 2013-02-13 Introduction à DART 5
  • 6. Le gagnant pour moi ? 2013-02-13 Introduction à DART 6
  • 7. Il était une fois… 2013-02-13 Introduction à DART 7
  • 9. Application évolutive 2013-02-13 Introduction à DART 9
  • 10. Rapidité d'exécution 2013-02-13 Introduction à DART 10
  • 11. Performance au démarrage 2013-02-13 Introduction à DART 11
  • 12. L'arrivée de DART ⦿ Open Source (BSD) ⦿ Structuré ⦿ Anti-Révolutionnaire ⦿ Dans la mouvance des frameworks JS ⦿ N’a pas pour objectif de casser le web 2013-02-13 Introduction à DART 12
  • 13. Classes abstraites abstract class Validatable { } 2013-02-13 Introduction à DART 13
  • 14. Classes abstraites abstract class Validatable { List<Object> valuesToValidate(); } 2013-02-13 Introduction à DART 14
  • 15. Classes abstraites abstract class Validator<T extends Validatable> { } 2013-02-13 Introduction à DART 15
  • 16. Classes abstraites abstract class Validator<T extends Validatable> { bool validate(T object) { } } 2013-02-13 Introduction à DART 16
  • 17. Classes abstraites abstract class Validator<T extends Validatable> { bool validate(T object) { for (Object obj in object.valuesToValidate()) { } } } 2013-02-13 Introduction à DART 17
  • 18. Classes abstraites abstract class Validator<T extends Validatable> { bool validate(T object) { for (Object obj in object.valuesToValidate()) { if (StringUtils.isEmpty(obj.toString())) { } } } } 2013-02-13 Introduction à DART 18
  • 19. Classes abstraites 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; } } 2013-02-13 Introduction à DART 19
  • 20. Classes concrètes class User { } 2013-02-13 Introduction à DART 20
  • 21. Classes concrètes class User implements Validatable { } 2013-02-13 Introduction à DART 21
  • 22. Classes concrètes class User implements Validatable { String username; String password; } 2013-02-13 Introduction à DART 22
  • 23. Classes concrètes class User implements Validatable { String username; String password; User(this.username, this.password); } 2013-02-13 Introduction à DART 23
  • 24. Classes concrètes class User implements Validatable { String username; String password; User(this.username, this.password); List<Object> valuesToValidate() { return [username, password]; } } 2013-02-13 Introduction à DART 24
  • 25. Mais ce n’est pas tout ⦿ Mixins ⦿ Optionnellement typé ⦿ Gouverné par des fonctions de haut niveau ⦿ Mono processus 2013-02-13 Introduction à DART 25
  • 26. Librairies disponibles ⦿ Core ⦿ TU et Mocks ⦿ HTML ⦿ Math ⦿ Async ⦿ Logging ⦿ IO ⦿ URI ⦿ Crypto ⦿ I18N ⦿ JSON ⦿ etc. ⦿ Mirrors ⦿ UTF 2013-02-13 Introduction à DART 26
  • 27. Futures / Callback Hell - JS getWinningNumber( (int result1) { updateResult(1, result1); getWinningNumber( (int result2) { updateResult(2, result2); getWinningNumber( (int result3) { updateResult(3, result3); getWinningNumber( (int result4) { updateResult(4, result4); getWinningNumber( (int result5) { updateResult(5, result5); getWinningNumber( (int result6) { updateResult(6, result6); //snip getResultsString() }); }); }); }); }); }); 2013-02-13 Introduction à DART 27
  • 28. Futures / Callback Hell - Dart void main() { getFutureWinningNumber() .then(next(1)) .then(next(2)) .then(next(3)) .then(next(4)) .then(next(5)) .then(next(6)); } Function next(int position) { return (int result) { updateResult(position, result); return getFutureWinningNumber(); }; } 2013-02-13 Introduction à DART 28
  • 29. Isolates 2013-02-13 Introduction à DART 29
  • 30. Machines Virtuelles 2013-02-13 Introduction à DART 30
  • 31. Dartium 2013-02-13 Introduction à DART 31
  • 32. DartEditor 2013-02-13 Introduction à DART 32
  • 33. Plugins 2013-02-13 Introduction à DART 33
  • 34. dart2js 2013-02-13 Introduction à DART 34
  • 35. dart2js 2013-02-13 Introduction à DART 35
  • 36. dart2js ⦿ Cible HTML5 ⦿ Tree Shaking ⦿ Agrégation/Minification ⦿ Optimisation 2013-02-13 Introduction à DART 36
  • 37. pub 2013-02-13 Introduction à DART 37
  • 38. pub pubspec.yaml name: pacifista_rocks description: The best application in the whole world version: 0.0.1 dependencies: great_lib: any 2013-02-13 Introduction à DART 38
  • 39. dartdoc /// This is a single-line documentation comment. /** * This is a multi-line documentation comment. * To generate the documentation: * $ dartdoc <filename> */ void main() { } 2013-02-13 Introduction à DART 39
  • 40. dartdoc 2013-02-13 Introduction à DART 40
  • 41. Utilisation ⦿ Création de sites Single-Page ⦿ Création d'application complètes ⦿ Jeux HTML 2013-02-13 Introduction à DART 41
  • 42. Roadmap Aujourd'hui : M2 Mi-fevrier : M3 Été : V1 ! 2013-02-13 Introduction à DART 42
  • 43. Aller plus loin 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 2013-02-13 Introduction à DART 43
  • 44. Des questions ? 2013-02-13 Introduction à DART 44