Slide 1

Slide 1 text

THE ADVENTUROUS DEVELOPERS GUIDE TO JVM LANGUAGES SIMON MAPLE @SJMAPLE

Slide 2

Slide 2 text

SIMON MAPLE @SJMAPLE ABOUT ME

Slide 3

Slide 3 text

SIMON MAPLE @SJMAPLE VIRTUAL JUG FOUNDER LONDON JUG CO-LEADER JAVA CHAMPION JAVAONE ROCKSTAR REBELLABS AUTHOR ABOUT ME

Slide 4

Slide 4 text

ABOUT YOU 0 25 50 75 100 Heard of the Language Used the language Java Groovy Scala Kotlin Ceylon Xtend Fantom Clojure

Slide 5

Slide 5 text

JAVA “Most people talk about Java the language, and this may sound odd coming from me, but I could hardly care less.”

Slide 6

Slide 6 text

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)

Slide 7

Slide 7 text

JAVA 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)

Slide 8

Slide 8 text

LANGUAGES BUILT FOR THE JVM

Slide 9

Slide 9 text

LANGUAGES PORTED TO THE JVM

Slide 10

Slide 10 text

No content

Slide 11

Slide 11 text

No content

Slide 12

Slide 12 text

JAVA 8 1. Don’t break binary compatibility 2. Avoid introducing source incompatibilities 3. Manage behavioral compatibility changes

Slide 13

Slide 13 text

LET’S EXPERIMENT

Slide 14

Slide 14 text

No content

Slide 15

Slide 15 text

COMPANION CLASS NO STATIC KEYWORD import HttpServer._
 // import statics from companion object

Slide 16

Slide 16 text

VARIABLES THERE IS NO FINAL KEYWORD val name: Type = initializer // immutable value 
 var name: Type = initializer // mutable variable

Slide 17

Slide 17 text

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 =

501 Not Implemented: { method } method

) ...

Slide 18

Slide 18 text

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

Slide 19

Slide 19 text

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

Slide 20

Slide 20 text

COMPLEXITY?

Slide 21

Slide 21 text

No content

Slide 22

Slide 22 text

No content

Slide 23

Slide 23 text

No content

Slide 24

Slide 24 text

No content

Slide 25

Slide 25 text

JAVA SUPERCHARGED!

Slide 26

Slide 26 text

NULL def streetName = user?.address?.street

Slide 27

Slide 27 text

ELVIS LIVES def displayName = user.name ?: "Anonymous"

Slide 28

Slide 28 text

CLOSURES square = { it * it } [ 1, 2, 3, 4 ].collect(square) // [1, 4, 9, 16]

Slide 29

Slide 29 text

COLLECTIONS def names = ["Ted", "Fred", "Jed", "Ned"] println names //[Ted, Fred, Jed, Ned] def shortNames = names.findAll { it.size() <= 3 } shortNames.each { println it } // Ted // Jed // Ned

Slide 30

Slide 30 text

GROOVY 2.0 - DYNATIC void someMethod() {} 
 void test() { sommeeMethod() } 


Slide 31

Slide 31 text

GROOVY 2.0 - DYNATIC import groovy.transform.TypeChecked void someMethod() {} @TypeChecked 
 void test() { sommeeMethod() } 


Slide 32

Slide 32 text

GROOVY 2.0 - DYNATIC import groovy.transform.TypeChecked void someMethod() {} @TypeChecked 
 void test() { //compilation error: //cannot find matching method sommeeMethod() sommeeMethod() } 


Slide 33

Slide 33 text

YAH, WE SAVE LIVES!

Slide 34

Slide 34 text

No content

Slide 35

Slide 35 text

LET’S EXPERIMENT

Slide 36

Slide 36 text

No content

Slide 37

Slide 37 text

LET’S EXPERIMENT

Slide 38

Slide 38 text

No content

Slide 39

Slide 39 text

LET’S EXPERIMENT

Slide 40

Slide 40 text

SUMMARY Functions are first class citizens and should be treated as such!

Slide 41

Slide 41 text

SUMMARY EvErY-ONe’S 5YNT4X SuCkS...

Slide 42

Slide 42 text

SUMMARY …to someone else! EvErY-ONe’S 5YNT4X SuCkS...

Slide 43

Slide 43 text

SUMMARY The JVM is AWESOME

Slide 44

Slide 44 text

SUMMARY BE ADVENTUROUS! The JVM is AWESOME

Slide 45

Slide 45 text

YOU, ONE HOUR LATER 0 25 50 75 100 Heard of the Lang Java Groovy Scala Kotlin Ceylon Xtend Fantom Clojure

Slide 46

Slide 46 text

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/

Slide 47

Slide 47 text

47 FREE STUFF! 0t.ee/javaone-jr 0t.ee/javaone-xr

Slide 48

Slide 48 text

No content