SlideShare une entreprise Scribd logo
1  sur  59
Télécharger pour lire hors ligne
THE ADVENTUROUS
DEVELOPERS GUIDE
TO JVM LANGUAGES
SIMON MAPLE
@SJMAPLE
Monday, 30 September 13
Monday, 30 September 13
YOUR SPEAKER
SIMON MAPLE
@SJMAPLE
Monday, 30 September 13
MY AUDIENCE
0
25
50
75
100
Heard of the Language Used the language
Java Scala Groovy Clojure Ceylon Kotlin Xtend
Monday, 30 September 13
JAVA
“Most people talk about Java the language, and this may
sound odd coming from me, but I could hardly care less.
At the core of the Java ecosystem is the JVM.”
James Gosling,
creator of the Java programming language (2011, TheServerSide)
Monday, 30 September 13
JAVA THE JVM
“Most people talk about Java the language, and this may
sound odd coming from me, but I could hardly care less.
At the core of the Java ecosystem is the JVM.”
James Gosling,
creator of the Java programming language (2011, TheServerSide)
Monday, 30 September 13
LANGUAGES BUILT FOR THE JVM
Monday, 30 September 13
LANGUAGES PORTED TO THE JVM
Monday, 30 September 13
R.I.P ?
Monday, 30 September 13
Monday, 30 September 13
Monday, 30 September 13
JAVA 8
1. DON’T BREAK BINARY COMPATIBILITY
2.AVOID INTRODUCING SOURCE INCOMPATIBILITIES
3. MANAGE BEHAVIORAL COMPATIBILITY CHANGES
Monday, 30 September 13
LET’S EXPERIMENT
Monday, 30 September 13
Monday, 30 September 13
COMPANION CLASS
THERE IS NO STATIC
import HttpServer._
// import statics from companion object
Monday, 30 September 13
VARIABLES
THERE IS NO FINAL
val name: Type = initializer // immutable value
var name: Type = initializer // mutable variable
Monday, 30 September 13
CASE CLASS
case class Status(code: Int, text: String)
	 case method @ ("GET" | "HEAD") =>
	 ...
	 case method =>
	 respondWithHtml(
	 Status(501,
	 "Not Implemented"),
	 title = "501 Not Implemented",
	 ) body = <H2>501 Not Implemented: { method } method</H2>
	 ...
Monday, 30 September 13
STRINGS
val header = s"""
	 	 	 	 |HTTP/1.1 ${status.code} ${status.text}
	 	 	 	 |Server: Scala HTTP Server 1.0
	 	 	 	 |Date: ${new Date()}
	 	 	 	 |Content-type: ${contentType}
	 	 	 	 |Content-length: ${content.length}
	 	 	 	 """.trim.stripMargin + LineSep + LineSep
Monday, 30 September 13
NULL
def toFile(file: File, isRetry: Boolean = false): Option[File] =
if (file.isDirectory && !isRetry)
	 toFile(new File(file, DefaultFile), true)
	 else if (file.isFile)
Some(file)
	 else
	 	 None
Monday, 30 September 13
COMPLEXITY
Monday, 30 September 13
Monday, 30 September 13
Monday, 30 September 13
Monday, 30 September 13
Monday, 30 September 13
JAVA SUPERCHARGED!
Monday, 30 September 13
NULL
def streetName = user?.address?.street
Monday, 30 September 13
ELVIS LIVES
def displayName = user.name ?: "Anonymous"
Monday, 30 September 13
CLOSURES
square = { it * it }
[ 1, 2, 3, 4 ].collect(square) // [1, 4, 9, 16]
Monday, 30 September 13
COLLECTIONS
	 	 def names = ["Ted", "Fred", "Jed", "Ned"]
	 	 	 	
5p[5 println names //[Ted, Fred, Jed, Ned]
	 	 	 	 def shortNames = names.findAll { it.size() <= 3 }
	 	 	 	 shortNames.each { println it } // Ted
	 	 	 	 // Jed
	 	 	 	 // Ned
Monday, 30 September 13
GROOVY 2.0 - DYNATIC
void someMethod() {}
void test() {
sommeeMethod()
}
Monday, 30 September 13
GROOVY 2.0 - DYNATIC
void someMethod() {}
void test() {
sommeeMethod()
}
import groovy.transform.TypeChecked
@TypeChecked
Monday, 30 September 13
GROOVY 2.0 - DYNATIC
void someMethod() {}
void test() {
sommeeMethod()
}
	 	 // compilation error:
	 	 // cannot find matching method sommeeMethod()
import groovy.transform.TypeChecked
@TypeChecked
Monday, 30 September 13
Monday, 30 September 13
Founder/CEO Jevgeni “Hosselhuff” Kabanov gets ready to save
more Java developers from redeploy madness with JRebel
YEH, WE SAVE LIVES
Monday, 30 September 13
Monday, 30 September 13
REPL
<Python user> Can you believe these JVM geeks think this is impressive?
<Perl user> Tell me about it! Welcome to the 90s
<Python user> Yeh, “Hey the 20th century called to say they wanted their code back”!
<Groovy user> Hey, we do this too!
Monday, 30 September 13
FUNCTIONAL PRINCIPLES
1. LITTLE OR NO SIDE EFFECTS
2. FUNCTIONS SHOULD ALWAYS RETURN THE SAME
RESULT IF CALLED WITH THE SAME PARAMETERS
3. NO GLOBALVARIABLES
4. FUNCTIONS AS FIRST ORDER CITIZENS
5. LAZY EVALUATION OF EXPRESSIONS
Monday, 30 September 13
WHOA!
(defn send-html-response
	 	 	 	 "Html response"
	 	 	 	 [client-socket status title body]
	 	 	 	 (let [html (str "<HTML><HEAD><TITLE>"
	 	 	 	 title "</TITLE></HEAD><BODY>" body "</BODY></HTML>")]
	 	 	 	 send-http-response client-socket status "text/html"
	 	 	 	 (.getBytes html "UTF-8"))
	 	 	 	 ))
Monday, 30 September 13
LET’S GET FUNCTIONAL
	 	 (defn process-request
	 	 	 	 "Parse the HTTP request and decide what to do"
	 	 	 	 [client-socket]
	 	 	 	 (let [reader (get-reader client-socket) first-line
	 	 	 	 (.readLine reader) tokens (clojure.string/split first-line #"s+")]
	 	 	 	 (let [http-method (clojure.string/upper-case
	 	 	 	 (get tokens 0 "unknown"))]
	 	 	 	 (if (or (= http-method "GET") (= http-method "HEAD"))
	 	 	 	 (let [file-requested-name (get tokens 1 "not-existing")
	 	 	 	 [...]
Monday, 30 September 13
INTEROP
	 	 (ns clojure-http-server.core
	 	 	 (:require [clojure.string])
	 	 	 (:import (java.net ServerSocket SocketException) (java.util Date)
	 	 	 (java.io PrintWriter BufferedReader InputStreamReader BufferedOutputStream)))
Monday, 30 September 13
Monday, 30 September 13
LET’S EXPERIMENT
Monday, 30 September 13
Monday, 30 September 13
LET’S EXPERIMENT
Monday, 30 September 13
Monday, 30 September 13
LET’S EXPERIMENT
Monday, 30 September 13
SUMMARY
FUNCTIONS ARE
FIRST CLASS CITIZENS
AND SHOULD BE TREATED AS SUCH!
Monday, 30 September 13
SUMMARY
STATICALLY TYPED LANGUAGES ROCK
Monday, 30 September 13
SUMMARY
EVERYONE’S SYNTAX SUCKS...
Monday, 30 September 13
SUMMARY
EVERYONE’S SYNTAX SUCKS...
TO SOMEONE ELSE.
Monday, 30 September 13
SUMMARY
THE JVM IS AWESOME
Monday, 30 September 13
BE ADVENTUROUS!
Monday, 30 September 13
YOU, ONE HOUR LATER
0
25
50
75
100
Heard of the Lang
Java Scala Groovy Clojure Ceylon Kotlin Xtend
Monday, 30 September 13
REBEL LABS == AWESOME
99.9% NON-PRODUCT RELATED
TECH REPORTS WRITTEN BY
OUR DEVELOPERS
Monday, 30 September 13
REBEL LABS == AWESOME
JAVA 8,
CONTINUOUS DELIVERY,
APP SERVER DEBATE,
JVM WEB FRAMEWORKS,
PRODUCTIVITY REPORTS...
Monday, 30 September 13
REBEL LABS == AWESOME
AND...
THE ADVENTUROUS DEVELOPERS
GUIDE TO JVM LANGUAGES
Monday, 30 September 13
RESOURCES
HTTPSERVER EXAMPLES OF EACH LANGUAGE ON GITHUB
https://github.com/zeroturnaround/jvm-languages-report
THE ADVENTUROUS DEVELOPERS GUIDE TO JVM LANGUAGES
http://zeroturnaround.com/rebellabs/devs/the-
adventurous-developers-guide-to-jvm-languages/
Monday, 30 September 13
RESOURCES
SIMON MAPLE
@SJMAPLE
Monday, 30 September 13
Monday, 30 September 13

Contenu connexe

En vedette

Kotlin advanced - language reference for android developers
Kotlin advanced - language reference for android developersKotlin advanced - language reference for android developers
Kotlin advanced - language reference for android developers
Bartosz Kosarzycki
 
Who's More Functional: Kotlin, Groovy, Scala, or Java?
Who's More Functional: Kotlin, Groovy, Scala, or Java?Who's More Functional: Kotlin, Groovy, Scala, or Java?
Who's More Functional: Kotlin, Groovy, Scala, or Java?
Andrey Breslav
 

En vedette (11)

Do Languages Matter?
Do Languages Matter?Do Languages Matter?
Do Languages Matter?
 
Kotlin advanced - language reference for android developers
Kotlin advanced - language reference for android developersKotlin advanced - language reference for android developers
Kotlin advanced - language reference for android developers
 
Kotlin в production. Как и зачем?
Kotlin в production. Как и зачем?Kotlin в production. Как и зачем?
Kotlin в production. Как и зачем?
 
Programming in scala - 1
Programming in scala - 1Programming in scala - 1
Programming in scala - 1
 
JavaOne 2016 - Kotlin: The Language of The Future For JVM?
JavaOne 2016 - Kotlin: The Language of The Future For JVM?JavaOne 2016 - Kotlin: The Language of The Future For JVM?
JavaOne 2016 - Kotlin: The Language of The Future For JVM?
 
Kotlin: Why Do You Care?
Kotlin: Why Do You Care?Kotlin: Why Do You Care?
Kotlin: Why Do You Care?
 
TMPA-2015: Kotlin: From Null Dereference to Smart Casts
TMPA-2015: Kotlin: From Null Dereference to Smart CastsTMPA-2015: Kotlin: From Null Dereference to Smart Casts
TMPA-2015: Kotlin: From Null Dereference to Smart Casts
 
Scala in practice
Scala in practiceScala in practice
Scala in practice
 
[Expert Fridays] Java MeetUp - Борис Ташкулов (Teamlead Enterprise): "Почему ...
[Expert Fridays] Java MeetUp - Борис Ташкулов (Teamlead Enterprise): "Почему ...[Expert Fridays] Java MeetUp - Борис Ташкулов (Teamlead Enterprise): "Почему ...
[Expert Fridays] Java MeetUp - Борис Ташкулов (Teamlead Enterprise): "Почему ...
 
Who's More Functional: Kotlin, Groovy, Scala, or Java?
Who's More Functional: Kotlin, Groovy, Scala, or Java?Who's More Functional: Kotlin, Groovy, Scala, or Java?
Who's More Functional: Kotlin, Groovy, Scala, or Java?
 
Functional Programming Patterns (BuildStuff '14)
Functional Programming Patterns (BuildStuff '14)Functional Programming Patterns (BuildStuff '14)
Functional Programming Patterns (BuildStuff '14)
 

Plus de Simon Maple

Plus de Simon Maple (9)

Productivity Tips for Java EE and Spring Developers
 Productivity Tips for Java EE and Spring Developers Productivity Tips for Java EE and Spring Developers
Productivity Tips for Java EE and Spring Developers
 
Is Your Profiler Speaking The Same Language as You?
Is Your Profiler Speaking The Same Language as You?Is Your Profiler Speaking The Same Language as You?
Is Your Profiler Speaking The Same Language as You?
 
Do you really get Classloaders?
Do you really get Classloaders?Do you really get Classloaders?
Do you really get Classloaders?
 
10 productivity tips and tricks for developers
10 productivity tips and tricks for developers10 productivity tips and tricks for developers
10 productivity tips and tricks for developers
 
Is your profiler speaking the same language as you? -- Docklands JUG
Is your profiler speaking the same language as you? -- Docklands JUGIs your profiler speaking the same language as you? -- Docklands JUG
Is your profiler speaking the same language as you? -- Docklands JUG
 
DevoxxPL: JRebel Under The Covers
DevoxxPL: JRebel Under The CoversDevoxxPL: JRebel Under The Covers
DevoxxPL: JRebel Under The Covers
 
Devoxx PL: Is your profiler speaking the same language as you?
Devoxx PL: Is your profiler speaking the same language as you?Devoxx PL: Is your profiler speaking the same language as you?
Devoxx PL: Is your profiler speaking the same language as you?
 
Devoxx PL: Is your profiler speaking the same language as you?
Devoxx PL: Is your profiler speaking the same language as you?Devoxx PL: Is your profiler speaking the same language as you?
Devoxx PL: Is your profiler speaking the same language as you?
 
DevoxxUK: Is your profiler speaking the same language as you?
DevoxxUK: Is your profiler speaking the same language as you?DevoxxUK: Is your profiler speaking the same language as you?
DevoxxUK: Is your profiler speaking the same language as you?
 

Dernier

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Dernier (20)

Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 

The Adventurous Developers Guide to JVM Languages