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, 3...
JAVA
“Most people talk about Java the language, and this may
sound odd coming from me, but I could hardly care less.
At th...
JAVA THE JVM
“Most people talk about Java the language, and this may
sound odd coming from me, but I could hardly care les...
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...
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 variab...
CASE CLASS
case class Status(code: Int, text: String)
	 case method @ ("GET" | "HEAD") =>
	 ...
	 case method =>
	 respond...
STRINGS
val header = s"""
	 	 	 	 |HTTP/1.1 ${status.code} ${status.text}
	 	 	 	 |Server: Scala HTTP Server 1.0
	 	 	 	 |...
NULL
def toFile(file: File, isRetry: Boolean = false): Option[File] =
if (file.isDirectory && !isRetry)
	 toFile(new File(...
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 s...
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
...
GROOVY 2.0 - DYNATIC
void someMethod() {}
void test() {
sommeeMethod()
}
	 	 // compilation error:
	 	 // cannot find matc...
Monday, 30 September 13
Founder/CEO Jevgeni “Hosselhuff” Kabanov gets ready to save
more Java developers from redeploy madness with JRebel
YEH, WE ...
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 ...
FUNCTIONAL PRINCIPLES
1. LITTLE OR NO SIDE EFFECTS
2. FUNCTIONS SHOULD ALWAYS RETURN THE SAME
RESULT IF CALLED WITH THE SA...
WHOA!
(defn send-html-response
	 	 	 	 "Html response"
	 	 	 	 [client-socket status title body]
	 	 	 	 (let [html (str "...
LET’S GET FUNCTIONAL
	 	 (defn process-request
	 	 	 	 "Parse the HTTP request and decide what to do"
	 	 	 	 [client-sock...
INTEROP
	 	 (ns clojure-http-server.core
	 	 	 (:require [clojure.string])
	 	 	 (:import (java.net ServerSocket SocketExc...
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, ...
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 ADVENT...
RESOURCES
SIMON MAPLE
@SJMAPLE
Monday, 30 September 13
Monday, 30 September 13
Upcoming SlideShare
Loading in...5
×

The Adventurous Developers Guide to JVM Languages

1,857

Published on

There are more than 50 actively worked JVM languages in existence today. Some have been ported to the JVM, whereas others were written specifically for the JVM. This hands-on session takes an introductory (but non-Hello, World) look at several JVM languages, including Java 8, Scala, Groovy, Kotlin, Ceylon, Xtend, and Clojure. It covers ZeroTurnaround’s initial experiences, including what rocked and sucked in learning each one. You don’t need any prior knowledge of these languages to attend the session. You will learn whether they are for you and will hear about some real-life experiences of trying these languages for the first time.

Published in: Technology, News & Politics
0 Comments
3 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
1,857
On Slideshare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
31
Comments
0
Likes
3
Embeds 0
No embeds

No notes for slide

The Adventurous Developers Guide to JVM Languages

  1. 1. THE ADVENTUROUS DEVELOPERS GUIDE TO JVM LANGUAGES SIMON MAPLE @SJMAPLE Monday, 30 September 13
  2. 2. Monday, 30 September 13
  3. 3. YOUR SPEAKER SIMON MAPLE @SJMAPLE Monday, 30 September 13
  4. 4. 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
  5. 5. 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
  6. 6. 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
  7. 7. LANGUAGES BUILT FOR THE JVM Monday, 30 September 13
  8. 8. LANGUAGES PORTED TO THE JVM Monday, 30 September 13
  9. 9. R.I.P ? Monday, 30 September 13
  10. 10. Monday, 30 September 13
  11. 11. Monday, 30 September 13
  12. 12. JAVA 8 1. DON’T BREAK BINARY COMPATIBILITY 2.AVOID INTRODUCING SOURCE INCOMPATIBILITIES 3. MANAGE BEHAVIORAL COMPATIBILITY CHANGES Monday, 30 September 13
  13. 13. LET’S EXPERIMENT Monday, 30 September 13
  14. 14. Monday, 30 September 13
  15. 15. COMPANION CLASS THERE IS NO STATIC import HttpServer._ // import statics from companion object Monday, 30 September 13
  16. 16. VARIABLES THERE IS NO FINAL val name: Type = initializer // immutable value var name: Type = initializer // mutable variable Monday, 30 September 13
  17. 17. 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
  18. 18. 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
  19. 19. 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
  20. 20. COMPLEXITY Monday, 30 September 13
  21. 21. Monday, 30 September 13
  22. 22. Monday, 30 September 13
  23. 23. Monday, 30 September 13
  24. 24. Monday, 30 September 13
  25. 25. JAVA SUPERCHARGED! Monday, 30 September 13
  26. 26. NULL def streetName = user?.address?.street Monday, 30 September 13
  27. 27. ELVIS LIVES def displayName = user.name ?: "Anonymous" Monday, 30 September 13
  28. 28. CLOSURES square = { it * it } [ 1, 2, 3, 4 ].collect(square) // [1, 4, 9, 16] Monday, 30 September 13
  29. 29. 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
  30. 30. GROOVY 2.0 - DYNATIC void someMethod() {} void test() { sommeeMethod() } Monday, 30 September 13
  31. 31. GROOVY 2.0 - DYNATIC void someMethod() {} void test() { sommeeMethod() } import groovy.transform.TypeChecked @TypeChecked Monday, 30 September 13
  32. 32. 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
  33. 33. Monday, 30 September 13
  34. 34. 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
  35. 35. Monday, 30 September 13
  36. 36. 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
  37. 37. 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
  38. 38. 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
  39. 39. 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
  40. 40. 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
  41. 41. Monday, 30 September 13
  42. 42. LET’S EXPERIMENT Monday, 30 September 13
  43. 43. Monday, 30 September 13
  44. 44. LET’S EXPERIMENT Monday, 30 September 13
  45. 45. Monday, 30 September 13
  46. 46. LET’S EXPERIMENT Monday, 30 September 13
  47. 47. SUMMARY FUNCTIONS ARE FIRST CLASS CITIZENS AND SHOULD BE TREATED AS SUCH! Monday, 30 September 13
  48. 48. SUMMARY STATICALLY TYPED LANGUAGES ROCK Monday, 30 September 13
  49. 49. SUMMARY EVERYONE’S SYNTAX SUCKS... Monday, 30 September 13
  50. 50. SUMMARY EVERYONE’S SYNTAX SUCKS... TO SOMEONE ELSE. Monday, 30 September 13
  51. 51. SUMMARY THE JVM IS AWESOME Monday, 30 September 13
  52. 52. BE ADVENTUROUS! Monday, 30 September 13
  53. 53. YOU, ONE HOUR LATER 0 25 50 75 100 Heard of the Lang Java Scala Groovy Clojure Ceylon Kotlin Xtend Monday, 30 September 13
  54. 54. REBEL LABS == AWESOME 99.9% NON-PRODUCT RELATED TECH REPORTS WRITTEN BY OUR DEVELOPERS Monday, 30 September 13
  55. 55. REBEL LABS == AWESOME JAVA 8, CONTINUOUS DELIVERY, APP SERVER DEBATE, JVM WEB FRAMEWORKS, PRODUCTIVITY REPORTS... Monday, 30 September 13
  56. 56. REBEL LABS == AWESOME AND... THE ADVENTUROUS DEVELOPERS GUIDE TO JVM LANGUAGES Monday, 30 September 13
  57. 57. 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
  58. 58. RESOURCES SIMON MAPLE @SJMAPLE Monday, 30 September 13
  59. 59. Monday, 30 September 13
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×