SlideShare une entreprise Scribd logo
1  sur  46
Télécharger pour lire hors ligne
Andres	
  Almiray	
  
      @aalmiray	
  

Polyglot Programming
      in the JVM
ABOUT THE SPEAKER
Java developer since the beginning
True believer in Open Source
Groovy committer since 2007
Project lead of the Griffon framework
Currently working for
SOME FACTS ABOUT
JAVA
Previous name was Oak. Bonus points for knowing its real
name before that
Made its public appearance in 1995
C/C++ were king at the time
Networking, multithreading were baked right into the
language
Developers came for the applets and stayed for the
components (JEE and all that jazz)
HOWEVER...
It‘s already in its teens
It has not seen a groundbreaking feature upgrade since JDK5
was released back in 2004 -> generics (and we do know how
that turned out to be, don’t we?)
JDK7 was delayed again (late 2010, actual 2011). Some
features did not make the cut (lambdas)
JDK8, late 2013?
MORE SO...
It is rather verbose when compared to how other languages
do the same task
Its threading features are no longer enough. Concurrent
programs desperately cry for immutability these days
TRUTH OR MYTH?
Is Java oftenly referred as overengineered?
Can you build a Java based web application (for arguments
sake a basic Twitter clone) in less than a day‘s work
WITHOUT an IDE?
Did James Gosling ever say he was threatened with bodily
harm should operator overloading find its way into Java?
The JVM is a great
place to work however
Java makes it painful
sometimes...
What can we do about it?!
Polyglot Programming in the JVM - 33rd Degree
Polyglot Programming in the JVM - 33rd Degree
DISCLAIMER

(THIS IS NOT A BASH-THE-OTHER-
LANGUAGES TALK)
REDUCED
VERBOSITY
STANDARD BEANS
public class Bean {
    private String name;


    public String getName() {
        return name;
    }


    public void setName(String name) {
        this.name = name;
    }
}
STANDARD BEANS
public class Bean {
    private String name;


    public String getName() {
        return name;
    }


    public void setName(String name) {
        this.name = name;
    }
}
STANDARD BEANS



class Bean {
    String name
}
STANDARD BEANS



class Bean(var name:String)



class Bean {
  @scala.reflect.BeanProperty
  var name: String
}
STANDARD BEANS



(defstruct Bean :name)
CLOSURES (OR FUNCTIONS)
public interfaceAdder {
    int add(int a, int b);
}


public class  MyAdder implements Adder {
    public int add(int a, int b) {
      return a + b;
    }
}
CLOSURES (OR FUNCTIONS)
// JDK7^H8 Closures proposal

(int a, int b)(a + b)


#(int a, int b) { return a + b; }

(int a, int b) -> a + b
CLOSURES (OR FUNCTIONS)



def adder = { a , b -> a + b }
CLOSURES (OR FUNCTIONS)




val adder = (a:Int, b:Int) => a + b
CLOSURES (OR FUNCTIONS)



(defn adder [a b] (+ a b))
ENHANCED SWITCH
char letterGrade(int grade) {
    if(grade >= 0 && grade <= 60) return ‘F‘;
    if(grade > 60 && grade <= 70) return ‘D‘;
    if(grade > 70 && grade <= 80) return ‘C‘;
    if(grade > 80 && grade <= 90) return ‘B‘;
    if(grade > 90 && grade <= 100) return ‘A‘;
  throw new IllegalArgumentException(“invalid
grade “+grade);
}
ENHANCED SWITCH
def letterGrade(grade) {
  switch(grade) {
     case 90..100: return ‘A‘
     case 80..<90: return ‘B‘
     case 70..<80: return ‘C‘
     case 60..<70: return ‘D‘
     case 0..<60: return ‘F‘
     case ~"[ABCDFabcdf]":
          return grade.toUpperCase()
  }
  throw new IllegalArgumentException(‘invalid
grade ‘+grade)
}
ENHANCED SWITCH


val VALID_GRADES = Set("A", "B", "C", "D", "F")
def letterGrade(value: Any):String = value match {
  case x:Int if (90 to 100).contains(x) => "A"
  case x:Int if (80 to 90).contains(x) => "B"
  case x:Int if (70 to 80).contains(x) => "C"
  case x:Int if (60 to 70).contains(x) => "D"
  case x:Int if (0 to 60).contains(x) => "F"
  case x:String if VALID_GRADES(x.toUpperCase) =>
x.toUpperCase()
}
ENHANCED SWITCH

(defn letter-grade [grade]
  (cond
   (in grade 90 100) "A"
   (in grade 80 90) "B"
   (in grade 70 80) "C"
   (in grade 60 70) "D"
   (in grade 0 60) "F"
   (re-find #"[ABCDFabcdf]" grade) (.toUpperCase
grade)))
JAVA
INTEROPERA
BILITY
ALL OF THESE ARE
TRUE
Java can call Groovy, Scala and Clojure classes as if they
were Java classes
Groovy, Scala and Clojure can call Java code without
breaking a sweat


In other words, interoperability with Java is a given. No need
for complicated bridges between languages (i.e. JSR 223)
OK, SO...
WHAT ELSE
CAN THESE
LANGUAGES
DO?
ALL OF THEM
Native syntax for collection classes
Everything is an object
Closures!
Regular expressions as first class citizen
GROOVY
Metaprogramming (HOT!) both at buildtime and runtime
Builders
Operator overloading
Healthy ecosystem: Grails, Griffon, Gant, Gradle, Spock,
Gaelyk, Gpars, CodeNarc, etc...

Not an exhaustive list of features!
SCALA
Richer type system
Functional meets Object Oriented
Type inference
Pattern matching (+ case classes)
Actor model
Create your own operator
Traits



Not an exhaustive list of features!
CLOJURE
Data as code and viceversa
Immutable structures
STM



Not an exhaustive list of features!
DEMO
Polyglot Programming in the JVM - 33rd Degree
Polyglot Programming in the JVM - 33rd Degree
OTHER PLACES
WHERE YOU‘LL
FIND
POLYGLOT
PROGRAMMING
WEB APP
DEVELOPMENT
XML
SQL
JavaScript
JSON
CSS
Flash/Flex/ActionScript
NEXT-GEN
DATASTORES (NOSQL)
FleetDB -> Clojure

FlockDB -> Scala

CouchDB, Riak -> Erlang



By the way, watch out for Polyglot Persistence ;-)
BUILD SYSTEMS
Gradle, Gant -> Groovy

Rake -> Ruby/JRuby

Maven3 -> XML, Groovy, Ruby

SBT -> Scala

Leiningen -> Clojure
PARTING THOUGHTS
Java (the language) may have reached its maturity feature
wise
Other JVM languages have evolved faster
Polyglot Programming is not a new concept
Download and play with each of the demoed languages,
maybe one of them strikes your fancy
RESOURCES
RESOURCES
RESOURCES
Q&A
Thank You!
                @aalmiray
andres.almiray@canoo.com

Contenu connexe

Tendances

Introduction to Ruby
Introduction to RubyIntroduction to Ruby
Introduction to RubyRanjith Siji
 
BangaloreJUG introduction to kotlin
BangaloreJUG   introduction to kotlinBangaloreJUG   introduction to kotlin
BangaloreJUG introduction to kotlinChandra Sekhar Nayak
 
Develop your next app with kotlin @ AndroidMakersFr 2017
Develop your next app with kotlin @ AndroidMakersFr 2017Develop your next app with kotlin @ AndroidMakersFr 2017
Develop your next app with kotlin @ AndroidMakersFr 2017Arnaud Giuliani
 
Kotlin, smarter development for the jvm
Kotlin, smarter development for the jvmKotlin, smarter development for the jvm
Kotlin, smarter development for the jvmArnaud Giuliani
 
The Kotlin Programming Language, Svetlana Isakova
The Kotlin Programming Language, Svetlana IsakovaThe Kotlin Programming Language, Svetlana Isakova
The Kotlin Programming Language, Svetlana IsakovaVasil Remeniuk
 
Ankara Jug - Practical Functional Programming with Scala
Ankara Jug - Practical Functional Programming with ScalaAnkara Jug - Practical Functional Programming with Scala
Ankara Jug - Practical Functional Programming with ScalaEnsar Basri Kahveci
 
Scala at HUJI PL Seminar 2008
Scala at HUJI PL Seminar 2008Scala at HUJI PL Seminar 2008
Scala at HUJI PL Seminar 2008Yardena Meymann
 
Introduction to Functional Programming with Scala
Introduction to Functional Programming with ScalaIntroduction to Functional Programming with Scala
Introduction to Functional Programming with Scalapramode_ce
 
Kotlin hands on - MorningTech ekito 2017
Kotlin hands on - MorningTech ekito 2017Kotlin hands on - MorningTech ekito 2017
Kotlin hands on - MorningTech ekito 2017Arnaud Giuliani
 
10 Things I Hate About Scala
10 Things I Hate About Scala10 Things I Hate About Scala
10 Things I Hate About ScalaMeir Maor
 
P6 OO vs Moose (&Moo)
P6 OO vs Moose (&Moo)P6 OO vs Moose (&Moo)
P6 OO vs Moose (&Moo)lichtkind
 
Kotlin for Android - Vali Iorgu - mRready
Kotlin for Android - Vali Iorgu - mRreadyKotlin for Android - Vali Iorgu - mRready
Kotlin for Android - Vali Iorgu - mRreadyMobileAcademy
 
Kotlin in action
Kotlin in actionKotlin in action
Kotlin in actionCiro Rizzo
 
scala.reflect, Eugene Burmako
scala.reflect, Eugene Burmakoscala.reflect, Eugene Burmako
scala.reflect, Eugene BurmakoVasil Remeniuk
 
Introduction to kotlin + spring boot demo
Introduction to kotlin + spring boot demoIntroduction to kotlin + spring boot demo
Introduction to kotlin + spring boot demoMuhammad Abdullah
 
Java Intro
Java IntroJava Intro
Java Introbackdoor
 
Kotlin for Android Developers - 1
Kotlin for Android Developers - 1Kotlin for Android Developers - 1
Kotlin for Android Developers - 1Mohamed Nabil, MSc.
 
Kotlin cheat sheet by ekito
Kotlin cheat sheet by ekitoKotlin cheat sheet by ekito
Kotlin cheat sheet by ekitoArnaud Giuliani
 

Tendances (20)

Introduction to Ruby
Introduction to RubyIntroduction to Ruby
Introduction to Ruby
 
BangaloreJUG introduction to kotlin
BangaloreJUG   introduction to kotlinBangaloreJUG   introduction to kotlin
BangaloreJUG introduction to kotlin
 
Develop your next app with kotlin @ AndroidMakersFr 2017
Develop your next app with kotlin @ AndroidMakersFr 2017Develop your next app with kotlin @ AndroidMakersFr 2017
Develop your next app with kotlin @ AndroidMakersFr 2017
 
Kotlin, smarter development for the jvm
Kotlin, smarter development for the jvmKotlin, smarter development for the jvm
Kotlin, smarter development for the jvm
 
The Kotlin Programming Language, Svetlana Isakova
The Kotlin Programming Language, Svetlana IsakovaThe Kotlin Programming Language, Svetlana Isakova
The Kotlin Programming Language, Svetlana Isakova
 
Ankara Jug - Practical Functional Programming with Scala
Ankara Jug - Practical Functional Programming with ScalaAnkara Jug - Practical Functional Programming with Scala
Ankara Jug - Practical Functional Programming with Scala
 
Scala at HUJI PL Seminar 2008
Scala at HUJI PL Seminar 2008Scala at HUJI PL Seminar 2008
Scala at HUJI PL Seminar 2008
 
Introduction to Functional Programming with Scala
Introduction to Functional Programming with ScalaIntroduction to Functional Programming with Scala
Introduction to Functional Programming with Scala
 
Kotlin hands on - MorningTech ekito 2017
Kotlin hands on - MorningTech ekito 2017Kotlin hands on - MorningTech ekito 2017
Kotlin hands on - MorningTech ekito 2017
 
10 Things I Hate About Scala
10 Things I Hate About Scala10 Things I Hate About Scala
10 Things I Hate About Scala
 
P6 OO vs Moose (&Moo)
P6 OO vs Moose (&Moo)P6 OO vs Moose (&Moo)
P6 OO vs Moose (&Moo)
 
Kotlin for Android - Vali Iorgu - mRready
Kotlin for Android - Vali Iorgu - mRreadyKotlin for Android - Vali Iorgu - mRready
Kotlin for Android - Vali Iorgu - mRready
 
Kotlin in action
Kotlin in actionKotlin in action
Kotlin in action
 
Introducing Ruby
Introducing RubyIntroducing Ruby
Introducing Ruby
 
scala.reflect, Eugene Burmako
scala.reflect, Eugene Burmakoscala.reflect, Eugene Burmako
scala.reflect, Eugene Burmako
 
Xtext Webinar
Xtext WebinarXtext Webinar
Xtext Webinar
 
Introduction to kotlin + spring boot demo
Introduction to kotlin + spring boot demoIntroduction to kotlin + spring boot demo
Introduction to kotlin + spring boot demo
 
Java Intro
Java IntroJava Intro
Java Intro
 
Kotlin for Android Developers - 1
Kotlin for Android Developers - 1Kotlin for Android Developers - 1
Kotlin for Android Developers - 1
 
Kotlin cheat sheet by ekito
Kotlin cheat sheet by ekitoKotlin cheat sheet by ekito
Kotlin cheat sheet by ekito
 

Similaire à Polyglot Programming in the JVM - 33rd Degree

Introduction to Oracle Groovy
Introduction to Oracle GroovyIntroduction to Oracle Groovy
Introduction to Oracle GroovyDeepak Bhagat
 
Intro to scala
Intro to scalaIntro to scala
Intro to scalaJoe Zulli
 
A Sceptical Guide to Functional Programming
A Sceptical Guide to Functional ProgrammingA Sceptical Guide to Functional Programming
A Sceptical Guide to Functional ProgrammingGarth Gilmour
 
Introduction To Groovy
Introduction To GroovyIntroduction To Groovy
Introduction To Groovymanishkp84
 
The Future of JVM Languages
The Future of JVM Languages The Future of JVM Languages
The Future of JVM Languages VictorSzoltysek
 
Designing with Groovy Traits - Gr8Conf India
Designing with Groovy Traits - Gr8Conf IndiaDesigning with Groovy Traits - Gr8Conf India
Designing with Groovy Traits - Gr8Conf IndiaNaresha K
 
Why Java Sucks and C# Rocks (Final)
Why Java Sucks and C# Rocks (Final)Why Java Sucks and C# Rocks (Final)
Why Java Sucks and C# Rocks (Final)jeffz
 
GTAC Boosting your Testing Productivity with Groovy
GTAC Boosting your Testing Productivity with GroovyGTAC Boosting your Testing Productivity with Groovy
GTAC Boosting your Testing Productivity with GroovyAndres Almiray
 
Javaone2008 Bof 5101 Groovytesting
Javaone2008 Bof 5101 GroovytestingJavaone2008 Bof 5101 Groovytesting
Javaone2008 Bof 5101 GroovytestingAndres Almiray
 
Boosting Your Testing Productivity with Groovy
Boosting Your Testing Productivity with GroovyBoosting Your Testing Productivity with Groovy
Boosting Your Testing Productivity with GroovyJames Williams
 
Introduction to CDI and DI in Java EE 6
Introduction to CDI and DI in Java EE 6Introduction to CDI and DI in Java EE 6
Introduction to CDI and DI in Java EE 6Ray Ploski
 
2007 09 10 Fzi Training Groovy Grails V Ws
2007 09 10 Fzi Training Groovy Grails V Ws2007 09 10 Fzi Training Groovy Grails V Ws
2007 09 10 Fzi Training Groovy Grails V Wsloffenauer
 
Starting with Scala : Frontier Developer's Meetup December 2010
Starting with Scala : Frontier Developer's Meetup December 2010Starting with Scala : Frontier Developer's Meetup December 2010
Starting with Scala : Frontier Developer's Meetup December 2010Derek Chen-Becker
 
Oscon Java Testing on the Fast Lane
Oscon Java Testing on the Fast LaneOscon Java Testing on the Fast Lane
Oscon Java Testing on the Fast LaneAndres Almiray
 
Polyglot Programming @ CONFESS
Polyglot Programming @ CONFESSPolyglot Programming @ CONFESS
Polyglot Programming @ CONFESSAndres Almiray
 
FP in Java - Project Lambda and beyond
FP in Java - Project Lambda and beyondFP in Java - Project Lambda and beyond
FP in Java - Project Lambda and beyondMario Fusco
 
Real life-coffeescript
Real life-coffeescriptReal life-coffeescript
Real life-coffeescriptDavid Furber
 

Similaire à Polyglot Programming in the JVM - 33rd Degree (20)

Introduction to Oracle Groovy
Introduction to Oracle GroovyIntroduction to Oracle Groovy
Introduction to Oracle Groovy
 
Intro to scala
Intro to scalaIntro to scala
Intro to scala
 
A Sceptical Guide to Functional Programming
A Sceptical Guide to Functional ProgrammingA Sceptical Guide to Functional Programming
A Sceptical Guide to Functional Programming
 
Svcc Groovy Testing
Svcc Groovy TestingSvcc Groovy Testing
Svcc Groovy Testing
 
Clojure And Swing
Clojure And SwingClojure And Swing
Clojure And Swing
 
Introduction To Groovy
Introduction To GroovyIntroduction To Groovy
Introduction To Groovy
 
The Future of JVM Languages
The Future of JVM Languages The Future of JVM Languages
The Future of JVM Languages
 
Designing with Groovy Traits - Gr8Conf India
Designing with Groovy Traits - Gr8Conf IndiaDesigning with Groovy Traits - Gr8Conf India
Designing with Groovy Traits - Gr8Conf India
 
Why Java Sucks and C# Rocks (Final)
Why Java Sucks and C# Rocks (Final)Why Java Sucks and C# Rocks (Final)
Why Java Sucks and C# Rocks (Final)
 
Groovy!
Groovy!Groovy!
Groovy!
 
GTAC Boosting your Testing Productivity with Groovy
GTAC Boosting your Testing Productivity with GroovyGTAC Boosting your Testing Productivity with Groovy
GTAC Boosting your Testing Productivity with Groovy
 
Javaone2008 Bof 5101 Groovytesting
Javaone2008 Bof 5101 GroovytestingJavaone2008 Bof 5101 Groovytesting
Javaone2008 Bof 5101 Groovytesting
 
Boosting Your Testing Productivity with Groovy
Boosting Your Testing Productivity with GroovyBoosting Your Testing Productivity with Groovy
Boosting Your Testing Productivity with Groovy
 
Introduction to CDI and DI in Java EE 6
Introduction to CDI and DI in Java EE 6Introduction to CDI and DI in Java EE 6
Introduction to CDI and DI in Java EE 6
 
2007 09 10 Fzi Training Groovy Grails V Ws
2007 09 10 Fzi Training Groovy Grails V Ws2007 09 10 Fzi Training Groovy Grails V Ws
2007 09 10 Fzi Training Groovy Grails V Ws
 
Starting with Scala : Frontier Developer's Meetup December 2010
Starting with Scala : Frontier Developer's Meetup December 2010Starting with Scala : Frontier Developer's Meetup December 2010
Starting with Scala : Frontier Developer's Meetup December 2010
 
Oscon Java Testing on the Fast Lane
Oscon Java Testing on the Fast LaneOscon Java Testing on the Fast Lane
Oscon Java Testing on the Fast Lane
 
Polyglot Programming @ CONFESS
Polyglot Programming @ CONFESSPolyglot Programming @ CONFESS
Polyglot Programming @ CONFESS
 
FP in Java - Project Lambda and beyond
FP in Java - Project Lambda and beyondFP in Java - Project Lambda and beyond
FP in Java - Project Lambda and beyond
 
Real life-coffeescript
Real life-coffeescriptReal life-coffeescript
Real life-coffeescript
 

Plus de Andres Almiray

Creando, creciendo, y manteniendo una comunidad de codigo abierto
Creando, creciendo, y manteniendo una comunidad de codigo abiertoCreando, creciendo, y manteniendo una comunidad de codigo abierto
Creando, creciendo, y manteniendo una comunidad de codigo abiertoAndres Almiray
 
Liberando a produccion con confianza
Liberando a produccion con confianzaLiberando a produccion con confianza
Liberando a produccion con confianzaAndres Almiray
 
Liberando a produccion con confidencia
Liberando a produccion con confidenciaLiberando a produccion con confidencia
Liberando a produccion con confidenciaAndres Almiray
 
OracleDB Ecosystem for Java Developers
OracleDB Ecosystem for Java DevelopersOracleDB Ecosystem for Java Developers
OracleDB Ecosystem for Java DevelopersAndres Almiray
 
Softcon.ph - Maven Puzzlers
Softcon.ph - Maven PuzzlersSoftcon.ph - Maven Puzzlers
Softcon.ph - Maven PuzzlersAndres Almiray
 
Oracle Database Ecosystem for Java Developers
Oracle Database Ecosystem for Java DevelopersOracle Database Ecosystem for Java Developers
Oracle Database Ecosystem for Java DevelopersAndres Almiray
 
JReleaser - Releasing at the speed of light
JReleaser - Releasing at the speed of lightJReleaser - Releasing at the speed of light
JReleaser - Releasing at the speed of lightAndres Almiray
 
Building modular applications with the Java Platform Module System and Layrry
Building modular applications with the Java Platform Module System and LayrryBuilding modular applications with the Java Platform Module System and Layrry
Building modular applications with the Java Platform Module System and LayrryAndres Almiray
 
Going Reactive with g rpc
Going Reactive with g rpcGoing Reactive with g rpc
Going Reactive with g rpcAndres Almiray
 
Building modular applications with JPMS and Layrry
Building modular applications with JPMS and LayrryBuilding modular applications with JPMS and Layrry
Building modular applications with JPMS and LayrryAndres Almiray
 
Taking Micronaut out for a spin
Taking Micronaut out for a spinTaking Micronaut out for a spin
Taking Micronaut out for a spinAndres Almiray
 
Apache Groovy's Metaprogramming Options and You
Apache Groovy's Metaprogramming Options and YouApache Groovy's Metaprogramming Options and You
Apache Groovy's Metaprogramming Options and YouAndres Almiray
 
What I wish I knew about Maven years ago
What I wish I knew about Maven years agoWhat I wish I knew about Maven years ago
What I wish I knew about Maven years agoAndres Almiray
 
What I wish I knew about maven years ago
What I wish I knew about maven years agoWhat I wish I knew about maven years ago
What I wish I knew about maven years agoAndres Almiray
 
The impact of sci fi in tech
The impact of sci fi in techThe impact of sci fi in tech
The impact of sci fi in techAndres Almiray
 
Gradle Ex Machina - Devoxx 2019
Gradle Ex Machina - Devoxx 2019Gradle Ex Machina - Devoxx 2019
Gradle Ex Machina - Devoxx 2019Andres Almiray
 
Creating Better Builds with Gradle
Creating Better Builds with GradleCreating Better Builds with Gradle
Creating Better Builds with GradleAndres Almiray
 
Interacting with the Oracle Cloud Java SDK with Gradle
Interacting with the Oracle Cloud Java SDK with GradleInteracting with the Oracle Cloud Java SDK with Gradle
Interacting with the Oracle Cloud Java SDK with GradleAndres Almiray
 

Plus de Andres Almiray (20)

Creando, creciendo, y manteniendo una comunidad de codigo abierto
Creando, creciendo, y manteniendo una comunidad de codigo abiertoCreando, creciendo, y manteniendo una comunidad de codigo abierto
Creando, creciendo, y manteniendo una comunidad de codigo abierto
 
Liberando a produccion con confianza
Liberando a produccion con confianzaLiberando a produccion con confianza
Liberando a produccion con confianza
 
Liberando a produccion con confidencia
Liberando a produccion con confidenciaLiberando a produccion con confidencia
Liberando a produccion con confidencia
 
OracleDB Ecosystem for Java Developers
OracleDB Ecosystem for Java DevelopersOracleDB Ecosystem for Java Developers
OracleDB Ecosystem for Java Developers
 
Softcon.ph - Maven Puzzlers
Softcon.ph - Maven PuzzlersSoftcon.ph - Maven Puzzlers
Softcon.ph - Maven Puzzlers
 
Maven Puzzlers
Maven PuzzlersMaven Puzzlers
Maven Puzzlers
 
Oracle Database Ecosystem for Java Developers
Oracle Database Ecosystem for Java DevelopersOracle Database Ecosystem for Java Developers
Oracle Database Ecosystem for Java Developers
 
JReleaser - Releasing at the speed of light
JReleaser - Releasing at the speed of lightJReleaser - Releasing at the speed of light
JReleaser - Releasing at the speed of light
 
Building modular applications with the Java Platform Module System and Layrry
Building modular applications with the Java Platform Module System and LayrryBuilding modular applications with the Java Platform Module System and Layrry
Building modular applications with the Java Platform Module System and Layrry
 
Going Reactive with g rpc
Going Reactive with g rpcGoing Reactive with g rpc
Going Reactive with g rpc
 
Building modular applications with JPMS and Layrry
Building modular applications with JPMS and LayrryBuilding modular applications with JPMS and Layrry
Building modular applications with JPMS and Layrry
 
Taking Micronaut out for a spin
Taking Micronaut out for a spinTaking Micronaut out for a spin
Taking Micronaut out for a spin
 
Apache Groovy's Metaprogramming Options and You
Apache Groovy's Metaprogramming Options and YouApache Groovy's Metaprogramming Options and You
Apache Groovy's Metaprogramming Options and You
 
What I wish I knew about Maven years ago
What I wish I knew about Maven years agoWhat I wish I knew about Maven years ago
What I wish I knew about Maven years ago
 
What I wish I knew about maven years ago
What I wish I knew about maven years agoWhat I wish I knew about maven years ago
What I wish I knew about maven years ago
 
The impact of sci fi in tech
The impact of sci fi in techThe impact of sci fi in tech
The impact of sci fi in tech
 
Gradle Ex Machina - Devoxx 2019
Gradle Ex Machina - Devoxx 2019Gradle Ex Machina - Devoxx 2019
Gradle Ex Machina - Devoxx 2019
 
Creating Better Builds with Gradle
Creating Better Builds with GradleCreating Better Builds with Gradle
Creating Better Builds with Gradle
 
Interacting with the Oracle Cloud Java SDK with Gradle
Interacting with the Oracle Cloud Java SDK with GradleInteracting with the Oracle Cloud Java SDK with Gradle
Interacting with the Oracle Cloud Java SDK with Gradle
 
Gradle ex-machina
Gradle ex-machinaGradle ex-machina
Gradle ex-machina
 

Dernier

Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024D Cloud Solutions
 
Nanopower In Semiconductor Industry.pdf
Nanopower  In Semiconductor Industry.pdfNanopower  In Semiconductor Industry.pdf
Nanopower In Semiconductor Industry.pdfPedro Manuel
 
ADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDE
ADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDEADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDE
ADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDELiveplex
 
20230202 - Introduction to tis-py
20230202 - Introduction to tis-py20230202 - Introduction to tis-py
20230202 - Introduction to tis-pyJamie (Taka) Wang
 
COMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online CollaborationCOMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online Collaborationbruanjhuli
 
UiPath Studio Web workshop series - Day 7
UiPath Studio Web workshop series - Day 7UiPath Studio Web workshop series - Day 7
UiPath Studio Web workshop series - Day 7DianaGray10
 
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...DianaGray10
 
UiPath Platform: The Backend Engine Powering Your Automation - Session 1
UiPath Platform: The Backend Engine Powering Your Automation - Session 1UiPath Platform: The Backend Engine Powering Your Automation - Session 1
UiPath Platform: The Backend Engine Powering Your Automation - Session 1DianaGray10
 
UiPath Studio Web workshop series - Day 8
UiPath Studio Web workshop series - Day 8UiPath Studio Web workshop series - Day 8
UiPath Studio Web workshop series - Day 8DianaGray10
 
How Accurate are Carbon Emissions Projections?
How Accurate are Carbon Emissions Projections?How Accurate are Carbon Emissions Projections?
How Accurate are Carbon Emissions Projections?IES VE
 
9 Steps For Building Winning Founding Team
9 Steps For Building Winning Founding Team9 Steps For Building Winning Founding Team
9 Steps For Building Winning Founding TeamAdam Moalla
 
UiPath Community: AI for UiPath Automation Developers
UiPath Community: AI for UiPath Automation DevelopersUiPath Community: AI for UiPath Automation Developers
UiPath Community: AI for UiPath Automation DevelopersUiPathCommunity
 
Empowering Africa's Next Generation: The AI Leadership Blueprint
Empowering Africa's Next Generation: The AI Leadership BlueprintEmpowering Africa's Next Generation: The AI Leadership Blueprint
Empowering Africa's Next Generation: The AI Leadership BlueprintMahmoud Rabie
 
Designing A Time bound resource download URL
Designing A Time bound resource download URLDesigning A Time bound resource download URL
Designing A Time bound resource download URLRuncy Oommen
 
Secure your environment with UiPath and CyberArk technologies - Session 1
Secure your environment with UiPath and CyberArk technologies - Session 1Secure your environment with UiPath and CyberArk technologies - Session 1
Secure your environment with UiPath and CyberArk technologies - Session 1DianaGray10
 
Comparing Sidecar-less Service Mesh from Cilium and Istio
Comparing Sidecar-less Service Mesh from Cilium and IstioComparing Sidecar-less Service Mesh from Cilium and Istio
Comparing Sidecar-less Service Mesh from Cilium and IstioChristian Posta
 
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019IES VE
 
Salesforce Miami User Group Event - 1st Quarter 2024
Salesforce Miami User Group Event - 1st Quarter 2024Salesforce Miami User Group Event - 1st Quarter 2024
Salesforce Miami User Group Event - 1st Quarter 2024SkyPlanner
 

Dernier (20)

Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024
 
201610817 - edge part1
201610817 - edge part1201610817 - edge part1
201610817 - edge part1
 
Nanopower In Semiconductor Industry.pdf
Nanopower  In Semiconductor Industry.pdfNanopower  In Semiconductor Industry.pdf
Nanopower In Semiconductor Industry.pdf
 
ADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDE
ADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDEADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDE
ADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDE
 
20230202 - Introduction to tis-py
20230202 - Introduction to tis-py20230202 - Introduction to tis-py
20230202 - Introduction to tis-py
 
COMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online CollaborationCOMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online Collaboration
 
UiPath Studio Web workshop series - Day 7
UiPath Studio Web workshop series - Day 7UiPath Studio Web workshop series - Day 7
UiPath Studio Web workshop series - Day 7
 
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...
 
UiPath Platform: The Backend Engine Powering Your Automation - Session 1
UiPath Platform: The Backend Engine Powering Your Automation - Session 1UiPath Platform: The Backend Engine Powering Your Automation - Session 1
UiPath Platform: The Backend Engine Powering Your Automation - Session 1
 
UiPath Studio Web workshop series - Day 8
UiPath Studio Web workshop series - Day 8UiPath Studio Web workshop series - Day 8
UiPath Studio Web workshop series - Day 8
 
How Accurate are Carbon Emissions Projections?
How Accurate are Carbon Emissions Projections?How Accurate are Carbon Emissions Projections?
How Accurate are Carbon Emissions Projections?
 
9 Steps For Building Winning Founding Team
9 Steps For Building Winning Founding Team9 Steps For Building Winning Founding Team
9 Steps For Building Winning Founding Team
 
UiPath Community: AI for UiPath Automation Developers
UiPath Community: AI for UiPath Automation DevelopersUiPath Community: AI for UiPath Automation Developers
UiPath Community: AI for UiPath Automation Developers
 
Empowering Africa's Next Generation: The AI Leadership Blueprint
Empowering Africa's Next Generation: The AI Leadership BlueprintEmpowering Africa's Next Generation: The AI Leadership Blueprint
Empowering Africa's Next Generation: The AI Leadership Blueprint
 
20230104 - machine vision
20230104 - machine vision20230104 - machine vision
20230104 - machine vision
 
Designing A Time bound resource download URL
Designing A Time bound resource download URLDesigning A Time bound resource download URL
Designing A Time bound resource download URL
 
Secure your environment with UiPath and CyberArk technologies - Session 1
Secure your environment with UiPath and CyberArk technologies - Session 1Secure your environment with UiPath and CyberArk technologies - Session 1
Secure your environment with UiPath and CyberArk technologies - Session 1
 
Comparing Sidecar-less Service Mesh from Cilium and Istio
Comparing Sidecar-less Service Mesh from Cilium and IstioComparing Sidecar-less Service Mesh from Cilium and Istio
Comparing Sidecar-less Service Mesh from Cilium and Istio
 
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
 
Salesforce Miami User Group Event - 1st Quarter 2024
Salesforce Miami User Group Event - 1st Quarter 2024Salesforce Miami User Group Event - 1st Quarter 2024
Salesforce Miami User Group Event - 1st Quarter 2024
 

Polyglot Programming in the JVM - 33rd Degree

  • 1. Andres  Almiray   @aalmiray   Polyglot Programming in the JVM
  • 2. ABOUT THE SPEAKER Java developer since the beginning True believer in Open Source Groovy committer since 2007 Project lead of the Griffon framework Currently working for
  • 3. SOME FACTS ABOUT JAVA Previous name was Oak. Bonus points for knowing its real name before that Made its public appearance in 1995 C/C++ were king at the time Networking, multithreading were baked right into the language Developers came for the applets and stayed for the components (JEE and all that jazz)
  • 4. HOWEVER... It‘s already in its teens It has not seen a groundbreaking feature upgrade since JDK5 was released back in 2004 -> generics (and we do know how that turned out to be, don’t we?) JDK7 was delayed again (late 2010, actual 2011). Some features did not make the cut (lambdas) JDK8, late 2013?
  • 5. MORE SO... It is rather verbose when compared to how other languages do the same task Its threading features are no longer enough. Concurrent programs desperately cry for immutability these days
  • 6. TRUTH OR MYTH? Is Java oftenly referred as overengineered? Can you build a Java based web application (for arguments sake a basic Twitter clone) in less than a day‘s work WITHOUT an IDE? Did James Gosling ever say he was threatened with bodily harm should operator overloading find its way into Java?
  • 7. The JVM is a great place to work however Java makes it painful sometimes...
  • 8. What can we do about it?!
  • 11. DISCLAIMER (THIS IS NOT A BASH-THE-OTHER- LANGUAGES TALK)
  • 13. STANDARD BEANS public class Bean { private String name; public String getName() { return name; } public void setName(String name) { this.name = name; } }
  • 14. STANDARD BEANS public class Bean { private String name; public String getName() { return name; } public void setName(String name) { this.name = name; } }
  • 15. STANDARD BEANS class Bean { String name }
  • 16. STANDARD BEANS class Bean(var name:String) class Bean { @scala.reflect.BeanProperty var name: String }
  • 18. CLOSURES (OR FUNCTIONS) public interfaceAdder { int add(int a, int b); } public class MyAdder implements Adder { public int add(int a, int b) { return a + b; } }
  • 19. CLOSURES (OR FUNCTIONS) // JDK7^H8 Closures proposal (int a, int b)(a + b) #(int a, int b) { return a + b; } (int a, int b) -> a + b
  • 20. CLOSURES (OR FUNCTIONS) def adder = { a , b -> a + b }
  • 21. CLOSURES (OR FUNCTIONS) val adder = (a:Int, b:Int) => a + b
  • 22. CLOSURES (OR FUNCTIONS) (defn adder [a b] (+ a b))
  • 23. ENHANCED SWITCH char letterGrade(int grade) { if(grade >= 0 && grade <= 60) return ‘F‘; if(grade > 60 && grade <= 70) return ‘D‘; if(grade > 70 && grade <= 80) return ‘C‘; if(grade > 80 && grade <= 90) return ‘B‘; if(grade > 90 && grade <= 100) return ‘A‘; throw new IllegalArgumentException(“invalid grade “+grade); }
  • 24. ENHANCED SWITCH def letterGrade(grade) { switch(grade) { case 90..100: return ‘A‘ case 80..<90: return ‘B‘ case 70..<80: return ‘C‘ case 60..<70: return ‘D‘ case 0..<60: return ‘F‘ case ~"[ABCDFabcdf]": return grade.toUpperCase() } throw new IllegalArgumentException(‘invalid grade ‘+grade) }
  • 25. ENHANCED SWITCH val VALID_GRADES = Set("A", "B", "C", "D", "F") def letterGrade(value: Any):String = value match { case x:Int if (90 to 100).contains(x) => "A" case x:Int if (80 to 90).contains(x) => "B" case x:Int if (70 to 80).contains(x) => "C" case x:Int if (60 to 70).contains(x) => "D" case x:Int if (0 to 60).contains(x) => "F" case x:String if VALID_GRADES(x.toUpperCase) => x.toUpperCase() }
  • 26. ENHANCED SWITCH (defn letter-grade [grade] (cond (in grade 90 100) "A" (in grade 80 90) "B" (in grade 70 80) "C" (in grade 60 70) "D" (in grade 0 60) "F" (re-find #"[ABCDFabcdf]" grade) (.toUpperCase grade)))
  • 28. ALL OF THESE ARE TRUE Java can call Groovy, Scala and Clojure classes as if they were Java classes Groovy, Scala and Clojure can call Java code without breaking a sweat In other words, interoperability with Java is a given. No need for complicated bridges between languages (i.e. JSR 223)
  • 29. OK, SO... WHAT ELSE CAN THESE LANGUAGES DO?
  • 30. ALL OF THEM Native syntax for collection classes Everything is an object Closures! Regular expressions as first class citizen
  • 31. GROOVY Metaprogramming (HOT!) both at buildtime and runtime Builders Operator overloading Healthy ecosystem: Grails, Griffon, Gant, Gradle, Spock, Gaelyk, Gpars, CodeNarc, etc... Not an exhaustive list of features!
  • 32. SCALA Richer type system Functional meets Object Oriented Type inference Pattern matching (+ case classes) Actor model Create your own operator Traits Not an exhaustive list of features!
  • 33. CLOJURE Data as code and viceversa Immutable structures STM Not an exhaustive list of features!
  • 34. DEMO
  • 39. NEXT-GEN DATASTORES (NOSQL) FleetDB -> Clojure FlockDB -> Scala CouchDB, Riak -> Erlang By the way, watch out for Polyglot Persistence ;-)
  • 40. BUILD SYSTEMS Gradle, Gant -> Groovy Rake -> Ruby/JRuby Maven3 -> XML, Groovy, Ruby SBT -> Scala Leiningen -> Clojure
  • 41. PARTING THOUGHTS Java (the language) may have reached its maturity feature wise Other JVM languages have evolved faster Polyglot Programming is not a new concept Download and play with each of the demoed languages, maybe one of them strikes your fancy
  • 45. Q&A
  • 46. Thank You! @aalmiray andres.almiray@canoo.com