SlideShare une entreprise Scribd logo
1  sur  27
Télécharger pour lire hors ligne
Dart

One language to rule them all …

Sébastien Deleuze - @sdeleuze
Sébastien Deleuze
Worldline	
  
Lyon	
  
!

Architecte logiciel (qui code)	
  
Innovation Labs	
  
!

Projets Open Sources
Dart, c’est quoi exactement ?
Un langage structuré et flexible
pour les développements Web
(mais pas que)	
  
!
Destiné aux navigateurs
modernes	
  
!
Pour améliorer la

maintenabilité et l’efficacité de
nos développements
Une plateforme Open Source
Langage

Documentation

API

Outillage

Machine

virtuelle
Compilateur

Dart / Javascript

Framework

web
Dépôt de paquets
Comparaison
= Orienté Objet
= Facile à apprendre
= Performance de la JVM
!= Dette technologique
= Les fonctions sont «first class citizens»
= API asynchrone
!= Dart est fourni «battery-included»
Modèle de thread
Gestion de la concurence
Environnements d’exécution

Chrome (VM Dart)

Autres navigateurs

(dart2js + VM Javascript)
Environnements d’exécution
Chrome (VM Dart)
Serveur

?
PaaS

Autres navigateurs

(VM Javascript)

?

Android
Langage

Orienté objet, typage optionnel et interpolation de chaines
import 'dart:math';


!

class Point {	
  
num x, y;	
  

!
!

}	
  

!

Point(this.x, this.y);	
  
num distanceTo(Point other) {	
  
var dx = x - other.x;	
  
var dy = y - other.y;	
  
return sqrt(dx * dx + dy * dy);	
  
}	
  

main() { 	
  
var a = new Point(2, 3);	
  
var b = new Point(3, 4); 	
  
print('distance from a to b = ${a.distanceTo(b)}');	
  
}
Langage

Interfaces implicites
class Person {	
  
final _name;	
  
Person(this._name);	
  
String greet(who) => 'Hello, $who. I am $_name.';	
  
}	
  

!

class Bro implements Person {	
  
String greet(who) => 'Hi $who. What’s up?';	
  
}
Langage
Fonctions

Version longue
// Display 0 2 4 6 in the console
main() {
var array = [0, 1, 2, 3, 4, 5, 6];
for(var n in array) {
if(n.isEven) {
print(n);
}

}
}

Version courte
// Display 0 2 4 6 in the console
main() {

[0, 1, 2, 3, 4, 5, 6].where((n) => n.isEven).forEach(print);

}
Langage
Paramètres optionnels et valeurs par défaut
String say(String from, String msg, [String channel='email']) {	
  
// ...	
  
}	
  

!

main() { 	
  
say('Bob', 'Howdy');	
  
say('Bob', 'Howdy', 'smoke signal');	
  
}

Paramètres nommés et valeurs par défaut
enableFlags({bool bold: false, bool hidden: false}) { 	
  
// ...	
  
}	
  

!

main() { 	
  
enableFlags();	
  
enableFlags(bold: true);	
  
enableFlags(bold: true, hidden: false);	
  
}
Un langage facile à apprendre

I am watching you !
Langage
Mais aussi

- Constructeurs nommés
- Mixins
- Modèle de thread léger proche d’Erlang
- Métadatas
- Generics
- Reflection
API

dart:html
import 'dart:html';	
  

!

main() {	
  

!
!

var message = query('#msg');	
  

var b = new ButtonElement()	
  
..classes.add('important')	
  
..text = 'Bro Code'	
  
..onClick.listen((e) => message.text = '''A bro does
not dare/challenge another bro to do anything they wouldn’t
try them self''');	
  

!
!

}

document.body.children.add(b);	
  
API

dart:io
import 'dart:io';	
  

!

main() {	
  
HttpServer.bind('127.0.0.1', 8080).then((server) {	
  
server.listen((HttpRequest request) {	
  
request.response	
  
..write('A bro cannot give another bro a Teddy bear')	
  
..close();	
  
});	
  
print('web server started !');	
  
});	
  
}
Web components
Polymer.dart
Performance
Démarrage
700
525
Sans	
  snapshot
Avec	
  snapshot

350
175
0
Temps	
  de	
  chargement	
  d'un	
  programme	
  de	
  55000	
  lignes	
  (ms)
Performance
Exécution

250
200
150

Javascript
dart2js
Dart	
  VM
Java

100
50
0
DeltaBlue

Richards

Tracer
Performance

Single instruction, multiple data (SIMD)
var a = new Float32x4(1.0, 2.0, 3.0, 4.0);

var b = new Float32x4(5.0, 10.0, 15.0, 20.0);

var c = a + b;

1.0

5.0

6.0

2.0

10.0

12.0

3.0
4.0

+

12.0
20.0

=

15.0
24.0
Performance
Taille javascript généré
180
135
AngularJS
Dart
AngularJS	
  +	
  jQuery

90
45
0
Taille	
  de	
  l'applicaJon	
  Todo	
  (Ko)
Outillage
IDE : Dart Editor
Outillage

IDE : pas obligé d’utiliser Eclipse

Support de Dart dans Idea Intellij

et WebStorm

Spark
Outillage
pub

name: myproject

version: 1.1.0	
  
description: Sample application	
  
author: Sébastien Deleuze	
  
homepage: http://jyuro.org	
  
documentation: http://jyuro.org/doc	
  
dependencies:	
  
route: 0.4.5

mustache : '>=0.1.5'

mylib:	
  
     git: git://github.com/jyuro/mylib.git	
  
dev_dependencies:	
  
unittest: any
Outillage
pub.dartlang.org
Demos
• Projet Dart « Fullstack»	
  
• Three.dart
Conclusion
Dart 1.0 est sorti, testez-le ...
Quelques liens :	
  
- http://news.dartlang.org 	
  
- http://gplus.to/dartlangfr
- http://try.dartlang.org/
- https://github.com/sdeleuze/polymer-dart-blog

Sébastien Deleuze - @sdeleuze

Contenu connexe

En vedette

Dart : one language to rule them all - MixIT 2013
Dart : one language to rule them all - MixIT 2013Dart : one language to rule them all - MixIT 2013
Dart : one language to rule them all - MixIT 2013Sébastien Deleuze
 
Openscales Foss4g 2010 presentation
Openscales Foss4g 2010 presentationOpenscales Foss4g 2010 presentation
Openscales Foss4g 2010 presentationSébastien Deleuze
 
Presentation DVCS - Git - Mercurial au LyonJug
Presentation DVCS - Git - Mercurial au LyonJugPresentation DVCS - Git - Mercurial au LyonJug
Presentation DVCS - Git - Mercurial au LyonJugSébastien Deleuze
 
Resthub framework presentation
Resthub framework presentationResthub framework presentation
Resthub framework presentationSébastien Deleuze
 
Support de cours EJB 3 version complète Par Mr Youssfi, ENSET, Université Ha...
Support de cours EJB 3 version complète Par Mr  Youssfi, ENSET, Université Ha...Support de cours EJB 3 version complète Par Mr  Youssfi, ENSET, Université Ha...
Support de cours EJB 3 version complète Par Mr Youssfi, ENSET, Université Ha...ENSET, Université Hassan II Casablanca
 

En vedette (6)

Dart : one language to rule them all - MixIT 2013
Dart : one language to rule them all - MixIT 2013Dart : one language to rule them all - MixIT 2013
Dart : one language to rule them all - MixIT 2013
 
Openscales Foss4g 2010 presentation
Openscales Foss4g 2010 presentationOpenscales Foss4g 2010 presentation
Openscales Foss4g 2010 presentation
 
Presentation DVCS - Git - Mercurial au LyonJug
Presentation DVCS - Git - Mercurial au LyonJugPresentation DVCS - Git - Mercurial au LyonJug
Presentation DVCS - Git - Mercurial au LyonJug
 
Resthub framework presentation
Resthub framework presentationResthub framework presentation
Resthub framework presentation
 
Resthub lyonjug
Resthub lyonjugResthub lyonjug
Resthub lyonjug
 
Support de cours EJB 3 version complète Par Mr Youssfi, ENSET, Université Ha...
Support de cours EJB 3 version complète Par Mr  Youssfi, ENSET, Université Ha...Support de cours EJB 3 version complète Par Mr  Youssfi, ENSET, Université Ha...
Support de cours EJB 3 version complète Par Mr Youssfi, ENSET, Université Ha...
 

Similaire à Dart JUG 2013

Presentation langage go_19022015
Presentation langage go_19022015Presentation langage go_19022015
Presentation langage go_19022015Stéphane Legrand
 
Fiche de TD 1 de préparation probatoire (littéraire et scientifique) du Camer...
Fiche de TD 1 de préparation probatoire (littéraire et scientifique) du Camer...Fiche de TD 1 de préparation probatoire (littéraire et scientifique) du Camer...
Fiche de TD 1 de préparation probatoire (littéraire et scientifique) du Camer...ATPENSC-Group
 
Symfony2 - Un Framework PHP 5 Performant
Symfony2 - Un Framework PHP 5 PerformantSymfony2 - Un Framework PHP 5 Performant
Symfony2 - Un Framework PHP 5 PerformantHugo Hamon
 
Visual Basic 9.0 – Visual Studio 2008 Quoi De Neuf 2.0
Visual Basic 9.0 – Visual Studio 2008 Quoi De Neuf 2.0Visual Basic 9.0 – Visual Studio 2008 Quoi De Neuf 2.0
Visual Basic 9.0 – Visual Studio 2008 Quoi De Neuf 2.0Gregory Renard
 
Visual Basic 9.0 – Visual Studio 2008 Quoi De Neuf 2.0
Visual Basic 9.0 – Visual Studio 2008 Quoi De Neuf 2.0Visual Basic 9.0 – Visual Studio 2008 Quoi De Neuf 2.0
Visual Basic 9.0 – Visual Studio 2008 Quoi De Neuf 2.0Gregory Renard
 
Introduction au langage Go
Introduction au langage GoIntroduction au langage Go
Introduction au langage GoSylvain Wallez
 
Visual Studio 2008 Overview
Visual Studio 2008 OverviewVisual Studio 2008 Overview
Visual Studio 2008 OverviewGregory Renard
 
Domain-Specific Languages avec Groovy
Domain-Specific Languages avec GroovyDomain-Specific Languages avec Groovy
Domain-Specific Languages avec GroovyGuillaume Laforge
 
Rich Desktop Applications
Rich Desktop ApplicationsRich Desktop Applications
Rich Desktop Applicationsgoldoraf
 
Séminaire Ruby on Rails (novembre 2010)
Séminaire Ruby on Rails (novembre 2010)Séminaire Ruby on Rails (novembre 2010)
Séminaire Ruby on Rails (novembre 2010)Novelys
 
Dotnet j2 ee
Dotnet j2 eeDotnet j2 ee
Dotnet j2 eechdalel
 

Similaire à Dart JUG 2013 (20)

Presentation langage go_19022015
Presentation langage go_19022015Presentation langage go_19022015
Presentation langage go_19022015
 
Cours Ynov JS B1_1
Cours Ynov JS B1_1Cours Ynov JS B1_1
Cours Ynov JS B1_1
 
Fiche de TD 1 de préparation probatoire (littéraire et scientifique) du Camer...
Fiche de TD 1 de préparation probatoire (littéraire et scientifique) du Camer...Fiche de TD 1 de préparation probatoire (littéraire et scientifique) du Camer...
Fiche de TD 1 de préparation probatoire (littéraire et scientifique) du Camer...
 
Symfony2 - Un Framework PHP 5 Performant
Symfony2 - Un Framework PHP 5 PerformantSymfony2 - Un Framework PHP 5 Performant
Symfony2 - Un Framework PHP 5 Performant
 
Visual Basic 9.0 – Visual Studio 2008 Quoi De Neuf 2.0
Visual Basic 9.0 – Visual Studio 2008 Quoi De Neuf 2.0Visual Basic 9.0 – Visual Studio 2008 Quoi De Neuf 2.0
Visual Basic 9.0 – Visual Studio 2008 Quoi De Neuf 2.0
 
Visual Basic 9.0 – Visual Studio 2008 Quoi De Neuf 2.0
Visual Basic 9.0 – Visual Studio 2008 Quoi De Neuf 2.0Visual Basic 9.0 – Visual Studio 2008 Quoi De Neuf 2.0
Visual Basic 9.0 – Visual Studio 2008 Quoi De Neuf 2.0
 
Introduction au langage Go
Introduction au langage GoIntroduction au langage Go
Introduction au langage Go
 
Visual Studio 2008 Overview
Visual Studio 2008 OverviewVisual Studio 2008 Overview
Visual Studio 2008 Overview
 
Cours Php
Cours PhpCours Php
Cours Php
 
Cours Php
Cours PhpCours Php
Cours Php
 
HTML5 en projet
HTML5 en projetHTML5 en projet
HTML5 en projet
 
Apache ANT
Apache ANTApache ANT
Apache ANT
 
Tutoriel java
Tutoriel javaTutoriel java
Tutoriel java
 
Resume SGBDR
Resume SGBDRResume SGBDR
Resume SGBDR
 
Domain-Specific Languages avec Groovy
Domain-Specific Languages avec GroovyDomain-Specific Languages avec Groovy
Domain-Specific Languages avec Groovy
 
Applets
AppletsApplets
Applets
 
Rich Desktop Applications
Rich Desktop ApplicationsRich Desktop Applications
Rich Desktop Applications
 
Séminaire Ruby on Rails (novembre 2010)
Séminaire Ruby on Rails (novembre 2010)Séminaire Ruby on Rails (novembre 2010)
Séminaire Ruby on Rails (novembre 2010)
 
Tour Horizont.Net
Tour Horizont.NetTour Horizont.Net
Tour Horizont.Net
 
Dotnet j2 ee
Dotnet j2 eeDotnet j2 ee
Dotnet j2 ee
 

Dart JUG 2013