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.
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. 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
15. COMPANION CLASS
THERE IS NO STATIC
import HttpServer._
// import statics from companion object
Monday, 30 September 13
16. VARIABLES
THERE IS NO FINAL
val name: Type = initializer // immutable value
var name: Type = initializer // mutable variable
Monday, 30 September 13
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. 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. 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
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
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. 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. 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. 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
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. REBEL LABS == AWESOME
99.9% NON-PRODUCT RELATED
TECH REPORTS WRITTEN BY
OUR DEVELOPERS
Monday, 30 September 13
55. REBEL LABS == AWESOME
JAVA 8,
CONTINUOUS DELIVERY,
APP SERVER DEBATE,
JVM WEB FRAMEWORKS,
PRODUCTIVITY REPORTS...
Monday, 30 September 13
56. REBEL LABS == AWESOME
AND...
THE ADVENTUROUS DEVELOPERS
GUIDE TO JVM LANGUAGES
Monday, 30 September 13
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