SlideShare une entreprise Scribd logo
1  sur  20
Télécharger pour lire hors ligne
Play 2: Java ET Scala
Pour le meilleur et pour le pire
@blouerat
Bastien LOUËRAT
@blouerat
Développeur @ Clever Cloud
Hébergement Play
Développement :
Play 1, Play 2 Scala & Java
Play 2: Java ET Scala
Comment les deux
technologies se
marient-elles ?
Problèmes rencontrés
en passant de Scala
à Java.
The High Velocity
Web Framework
For Java and Scala
Historique
Play 1.x:
○ 2007: Projet interne @ Zenexity.
○ 2009: Open Sourcing. 1.0 release.
○ 2010: Play 1.1 (Netty, Async WS, Scala, Future)
○ 2011: Play 1.2 (Ivy, WebSockets, play.libs.F,
Promise<T>, await)
○ Décembre 2011: 1.2.4, fork yalp. Dev Play 2
Play 2.x
○ 2012: Play 2.0, Typesafe stack 2. Scala, Akka & sbt
○ 2013: Play 2.1, Scala 2.10, scala.concurrent.Future
1 framework, 2 APIs
Controllers
# Default path will just redirect to the computer list
GET / controllers.Application.index
# Computers list (look at the default values for pagination parameters)
GET /computers controllers.Application.list(p:Int ?= 0, s:Int ?
= 2, f ?= "")
# Add computer
GET /computers/new controllers.Application.create
POST /computers controllers.Application.save
# Edit existing computer
GET /computers/:id controllers.Application.edit(id:Long)
POST /computers/:id controllers.Application.update(id:Long)
VERB route reverse
Routing
Vues
● "You don’t have to write complicated Scala
code here" – Play for Java developpers
● @foo.bar != @{foo.`type`}
● error: No implicit Ordering
defined for Foo
foos.sorted
Vues
"We simply want to
offer a minimal set
of helpers"
Bases SQL
● Anorm par défaut. Minimal. Léger.
« Parfait pour les p'tites faims »
● Slick by Typesafe. Verbeux sans macro.
Bases SQL - Scala
● Ebean. Très léger. Génère mauvais DDL
pour évolution.
● JPA.
○ Hibernate 4.0 (conversion JodaTime)
○ Import du module javaJpa
○ @Transactionnal & Akka
Bases SQL - Java
Formulaires - côté vue
Reverse router
{Helpers
Html classique
public class User {
@Required
public String email;
public String password;
public String validate() {
if(authenticate(email,password) == null) {
return "Invalid email or password";
}
return null;
}
}
:)
:(
Formulaires - côté modèles
Exécution Asynchrone - Scala
Exécution Asynchrone - Java
'Simple' Build Tool
● Build.scala
● Très bonne documentation
● Maven SNAPSHOT via SSH
● Build system…
play4all
Play with us!
Auto-scalabilité / Supervision / Services
THAT'S ALL FOLKS!
@blouerat

Contenu connexe

Similaire à Play 2: java et scala

Enib cours c.a.i. web - séance #5 : scala play! framework
Enib   cours c.a.i. web - séance #5 : scala play! frameworkEnib   cours c.a.i. web - séance #5 : scala play! framework
Enib cours c.a.i. web - séance #5 : scala play! frameworkHoracio Gonzalez
 
.Net pour le développeur Java - une source d'inspiration?
.Net pour le développeur Java - une source d'inspiration?.Net pour le développeur Java - une source d'inspiration?
.Net pour le développeur Java - une source d'inspiration?Rui Carvalho
 
0251-formation-java-programmation-objet.pdf
0251-formation-java-programmation-objet.pdf0251-formation-java-programmation-objet.pdf
0251-formation-java-programmation-objet.pdfOmbotimbe Salifou
 
devoxx 2022 - 10 ans de Devoxx FR et de Java.pdf
devoxx 2022 - 10 ans de Devoxx FR et de Java.pdfdevoxx 2022 - 10 ans de Devoxx FR et de Java.pdf
devoxx 2022 - 10 ans de Devoxx FR et de Java.pdfJean-Michel Doudoux
 
Les nouveautés d'Unity 2018
Les nouveautés d'Unity 2018Les nouveautés d'Unity 2018
Les nouveautés d'Unity 2018Yannick Comte
 
Back to the future of java (from 8 to 11 and beyond)
Back to the future of java (from 8 to 11 and beyond)Back to the future of java (from 8 to 11 and beyond)
Back to the future of java (from 8 to 11 and beyond)Jérôme Tamborini
 
Quoi de neuf à Devoxx France 2017 ?
Quoi de neuf à Devoxx France 2017 ?Quoi de neuf à Devoxx France 2017 ?
Quoi de neuf à Devoxx France 2017 ?Antoine Rey
 
Play Framework
Play FrameworkPlay Framework
Play FrameworkArmaklan
 
Spark-adabra, Comment Construire un DATALAKE ! (Devoxx 2017)
Spark-adabra, Comment Construire un DATALAKE ! (Devoxx 2017) Spark-adabra, Comment Construire un DATALAKE ! (Devoxx 2017)
Spark-adabra, Comment Construire un DATALAKE ! (Devoxx 2017) univalence
 
Javascript as a first programming language : votre IC prête pour la révolution !
Javascript as a first programming language : votre IC prête pour la révolution !Javascript as a first programming language : votre IC prête pour la révolution !
Javascript as a first programming language : votre IC prête pour la révolution !VISEO
 
Voxxeddays lux 2018 apres java 8, java 9 et 10
Voxxeddays lux 2018 apres java 8, java 9 et 10Voxxeddays lux 2018 apres java 8, java 9 et 10
Voxxeddays lux 2018 apres java 8, java 9 et 10Jean-Michel Doudoux
 
Rouabhi algiers meetup
Rouabhi algiers meetupRouabhi algiers meetup
Rouabhi algiers meetupSamir Rouabhi
 
OOP & Design Pattern - Algiers Developers Meetup August 2015
OOP & Design Pattern - Algiers Developers Meetup August 2015OOP & Design Pattern - Algiers Developers Meetup August 2015
OOP & Design Pattern - Algiers Developers Meetup August 2015Tarik Zakaria Benmerar
 
Lyon JUG 2018 - Java le changement c'est maintenant
Lyon JUG 2018 - Java le changement c'est maintenantLyon JUG 2018 - Java le changement c'est maintenant
Lyon JUG 2018 - Java le changement c'est maintenantJean-Michel Doudoux
 

Similaire à Play 2: java et scala (20)

Enib cours c.a.i. web - séance #5 : scala play! framework
Enib   cours c.a.i. web - séance #5 : scala play! frameworkEnib   cours c.a.i. web - séance #5 : scala play! framework
Enib cours c.a.i. web - séance #5 : scala play! framework
 
Javaoop
JavaoopJavaoop
Javaoop
 
.Net pour le développeur Java - une source d'inspiration?
.Net pour le développeur Java - une source d'inspiration?.Net pour le développeur Java - une source d'inspiration?
.Net pour le développeur Java - une source d'inspiration?
 
0251-formation-java-programmation-objet.pdf
0251-formation-java-programmation-objet.pdf0251-formation-java-programmation-objet.pdf
0251-formation-java-programmation-objet.pdf
 
devoxx 2022 - 10 ans de Devoxx FR et de Java.pdf
devoxx 2022 - 10 ans de Devoxx FR et de Java.pdfdevoxx 2022 - 10 ans de Devoxx FR et de Java.pdf
devoxx 2022 - 10 ans de Devoxx FR et de Java.pdf
 
Les nouveautés d'Unity 2018
Les nouveautés d'Unity 2018Les nouveautés d'Unity 2018
Les nouveautés d'Unity 2018
 
Back to the future of java (from 8 to 11 and beyond)
Back to the future of java (from 8 to 11 and beyond)Back to the future of java (from 8 to 11 and beyond)
Back to the future of java (from 8 to 11 and beyond)
 
Quoi de neuf à Devoxx France 2017 ?
Quoi de neuf à Devoxx France 2017 ?Quoi de neuf à Devoxx France 2017 ?
Quoi de neuf à Devoxx France 2017 ?
 
Play Framework
Play FrameworkPlay Framework
Play Framework
 
Nouveautés Java 9-10-11
Nouveautés Java 9-10-11Nouveautés Java 9-10-11
Nouveautés Java 9-10-11
 
Spark-adabra, Comment Construire un DATALAKE ! (Devoxx 2017)
Spark-adabra, Comment Construire un DATALAKE ! (Devoxx 2017) Spark-adabra, Comment Construire un DATALAKE ! (Devoxx 2017)
Spark-adabra, Comment Construire un DATALAKE ! (Devoxx 2017)
 
Javascript as a first programming language : votre IC prête pour la révolution !
Javascript as a first programming language : votre IC prête pour la révolution !Javascript as a first programming language : votre IC prête pour la révolution !
Javascript as a first programming language : votre IC prête pour la révolution !
 
Voxxeddays lux 2018 apres java 8, java 9 et 10
Voxxeddays lux 2018 apres java 8, java 9 et 10Voxxeddays lux 2018 apres java 8, java 9 et 10
Voxxeddays lux 2018 apres java 8, java 9 et 10
 
Support NodeJS avec TypeScript Express MongoDB
Support NodeJS avec TypeScript Express MongoDBSupport NodeJS avec TypeScript Express MongoDB
Support NodeJS avec TypeScript Express MongoDB
 
Compte rendu Blend Web Mix 2015
Compte rendu Blend Web Mix 2015Compte rendu Blend Web Mix 2015
Compte rendu Blend Web Mix 2015
 
Rouabhi algiers meetup
Rouabhi algiers meetupRouabhi algiers meetup
Rouabhi algiers meetup
 
OOP and Design Patterns
OOP and Design PatternsOOP and Design Patterns
OOP and Design Patterns
 
OOP & Design Pattern - Algiers Developers Meetup August 2015
OOP & Design Pattern - Algiers Developers Meetup August 2015OOP & Design Pattern - Algiers Developers Meetup August 2015
OOP & Design Pattern - Algiers Developers Meetup August 2015
 
Lyon JUG 2018 - Java le changement c'est maintenant
Lyon JUG 2018 - Java le changement c'est maintenantLyon JUG 2018 - Java le changement c'est maintenant
Lyon JUG 2018 - Java le changement c'est maintenant
 
Chap 02 poo en java
Chap 02 poo en javaChap 02 poo en java
Chap 02 poo en java
 

Play 2: java et scala

  • 1. Play 2: Java ET Scala Pour le meilleur et pour le pire @blouerat
  • 2. Bastien LOUËRAT @blouerat Développeur @ Clever Cloud Hébergement Play Développement : Play 1, Play 2 Scala & Java
  • 3. Play 2: Java ET Scala Comment les deux technologies se marient-elles ? Problèmes rencontrés en passant de Scala à Java.
  • 4. The High Velocity Web Framework For Java and Scala
  • 5. Historique Play 1.x: ○ 2007: Projet interne @ Zenexity. ○ 2009: Open Sourcing. 1.0 release. ○ 2010: Play 1.1 (Netty, Async WS, Scala, Future) ○ 2011: Play 1.2 (Ivy, WebSockets, play.libs.F, Promise<T>, await) ○ Décembre 2011: 1.2.4, fork yalp. Dev Play 2 Play 2.x ○ 2012: Play 2.0, Typesafe stack 2. Scala, Akka & sbt ○ 2013: Play 2.1, Scala 2.10, scala.concurrent.Future
  • 8. # Default path will just redirect to the computer list GET / controllers.Application.index # Computers list (look at the default values for pagination parameters) GET /computers controllers.Application.list(p:Int ?= 0, s:Int ? = 2, f ?= "") # Add computer GET /computers/new controllers.Application.create POST /computers controllers.Application.save # Edit existing computer GET /computers/:id controllers.Application.edit(id:Long) POST /computers/:id controllers.Application.update(id:Long) VERB route reverse Routing
  • 10. ● "You don’t have to write complicated Scala code here" – Play for Java developpers ● @foo.bar != @{foo.`type`} ● error: No implicit Ordering defined for Foo foos.sorted Vues
  • 11. "We simply want to offer a minimal set of helpers" Bases SQL
  • 12. ● Anorm par défaut. Minimal. Léger. « Parfait pour les p'tites faims » ● Slick by Typesafe. Verbeux sans macro. Bases SQL - Scala
  • 13. ● Ebean. Très léger. Génère mauvais DDL pour évolution. ● JPA. ○ Hibernate 4.0 (conversion JodaTime) ○ Import du module javaJpa ○ @Transactionnal & Akka Bases SQL - Java
  • 14. Formulaires - côté vue Reverse router {Helpers Html classique
  • 15. public class User { @Required public String email; public String password; public String validate() { if(authenticate(email,password) == null) { return "Invalid email or password"; } return null; } } :) :( Formulaires - côté modèles
  • 18. 'Simple' Build Tool ● Build.scala ● Très bonne documentation ● Maven SNAPSHOT via SSH ● Build system…
  • 19. play4all Play with us! Auto-scalabilité / Supervision / Services