SlideShare una empresa de Scribd logo
1 de 59
Descargar para leer sin conexión
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

Más contenido relacionado

Destacado

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
 

Destacado (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)
 

Más de Simon Maple

Más 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?
 

Último

Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Último (20)

Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
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
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
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
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
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...
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
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
 
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...
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
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
 
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...
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 

The Adventurous Developers Guide to JVM Languages