Upgrade to Pro — share decks privately, control downloads, hide ads and more …

The Adventurous Developers Guide to JVM Languages

Simon Maple
November 03, 2015

The Adventurous Developers Guide to JVM Languages

This session was given at JavaOne 2015

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, and Xtend. 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.

Simon Maple

November 03, 2015
Tweet

More Decks by Simon Maple

Other Decks in Programming

Transcript

  1. SIMON MAPLE @SJMAPLE VIRTUAL JUG FOUNDER LONDON JUG CO-LEADER JAVA

    CHAMPION JAVAONE ROCKSTAR REBELLABS AUTHOR ABOUT ME
  2. ABOUT YOU 0 25 50 75 100 Heard of the

    Language Used the language Java Groovy Scala Kotlin Ceylon Xtend Fantom Clojure
  3. JAVA “Most people talk about Java the language, and this

    may sound odd coming from me, but I could hardly care less.”
  4. 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)
  5. 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)
  6. JAVA 8 1. Don’t break binary compatibility 2. Avoid introducing

    source incompatibilities 3. Manage behavioral compatibility changes
  7. VARIABLES THERE IS NO FINAL KEYWORD val name: Type =

    initializer // immutable value 
 var name: Type = initializer // mutable variable
  8. 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> ) ...
  9. 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
  10. 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
  11. CLOSURES square = { it * it } [ 1,

    2, 3, 4 ].collect(square) // [1, 4, 9, 16]
  12. 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
  13. GROOVY 2.0 - DYNATIC import groovy.transform.TypeChecked void someMethod() {} @TypeChecked

    
 void test() { //compilation error: //cannot find matching method sommeeMethod() sommeeMethod() } 

  14. YOU, ONE HOUR LATER 0 25 50 75 100 Heard

    of the Lang Java Groovy Scala Kotlin Ceylon Xtend Fantom Clojure
  15. 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/