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

Java is dead, long live Scala, Kotlin, Ceylon, etc.

Java is dead, long live Scala, Kotlin, Ceylon, etc.

Slides from my /dev/winter 2015 session.

Ca04455902d1b207348b6d406432718f?s=128

Russel Winder

January 24, 2015
Tweet

More Decks by Russel Winder

Other Decks in Technology

Transcript

  1. Copyright © 2014 Russel Winder 1 Java is Dead Long

    Live Scala, Kotlin, Ceylon, etc. Russel Winder email: russel@winder.org.uk twitter: @russel_winder Web: http://www.russel.org.uk
  2. Copyright © 2014 Russel Winder 2 Java is Dead

  3. Copyright © 2014 Russel Winder 3 Java is Dying

  4. Copyright © 2014 Russel Winder 4 What are the symptoms?

    • Java is seriously verbose. • Java has poor type inference. • Java has only low-level support for concurrency and parallelism. • Java generates a dependency hell . “ ” • Java is a 1990s imperative language that isn't really object-oriented. • …
  5. Copyright © 2014 Russel Winder 5 Is there a cure?

    • Can Java: • Be less verbose. • Have better type inferencing. • Do concurrency and parallelism better. (Doug Lea, Brian Goetz and others have actually been doing this for a while.) • Have a reasonable module system, cf. Jigsaw vs. OSGi. • Be a real object-oriented language.
  6. Copyright © 2014 Russel Winder 6 Prognosis: not great

  7. Copyright © 2014 Russel Winder 7 Alternatives?

  8. Copyright © 2014 Russel Winder 8 Create a new language

    • Java is a statically typed, compiled language, so create a new statically typed compiled language: • Scala • Kotlin • Ceylon • Fantom • Gosu • ?
  9. Copyright © 2014 Russel Winder 9 Gross oversimplifications…

  10. Copyright © 2014 Russel Winder 10 Scala • Integrates functional

    and object-oriented. • Very declarative style of expression. • Strong support for data parallelism. Also Akka for actors and such-like. • Strong static type checking with inferencing and reified generic type parameters.
  11. Copyright © 2014 Russel Winder 11 Kotlin • Top-level functions.

    • Object-oriented, with functional elements • Strong static type checking with inferencing. • Has modules. • Allows extension methods. • Compiles to JavaScript or JVM to support end-to-end Web applications development.
  12. Copyright © 2014 Russel Winder 12 Ceylon • Top-level functions.

    • Object oriented with functional features. • Strong static typing with inference. • Explicit module system. • JavaScript and JVM backends so as to be end-to-end for Web applications development.
  13. Copyright © 2014 Russel Winder 13 Fantom • Top-level functions.

    • Object-oriented. • Integrated modules system via pods. • Targets JVM and CLR.
  14. Copyright © 2014 Russel Winder 14 Gosu • Top-level functions.

    • Object-oriented. • Scripts.
  15. Copyright © 2014 Russel Winder 15 ? The identity of

    this statically typed, object-oriented (with functional bits) language for the JVM will remain unnamed at this time to preserve the air of mystery and suspense.
  16. Copyright © 2014 Russel Winder 16

  17. Copyright © 2014 Russel Winder 17 Code!

  18. Copyright © 2014 Russel Winder 18

  19. Copyright © 2014 Russel Winder 19 

  20. Copyright © 2014 Russel Winder 20

  21. Copyright © 2014 Russel Winder 21 What is the value

    of ?
  22. Copyright © 2014 Russel Winder 22 Well that's easy, it's…

  23. Copyright © 2014 Russel Winder 23 

  24. Copyright © 2014 Russel Winder 24 Obviously.

  25. Copyright © 2014 Russel Winder 25 It's simples Александр Орлов

    2009
  26. Copyright © 2014 Russel Winder 26 Approximating  • What

    is it's value represented as a floating point number? • We can only obtain an approximation. • A plethora of possible algorithms to choose from, a popular one is to employ the following integral equation. π 4 =∫ 0 1 1 1+x2 dx
  27. Copyright © 2014 Russel Winder 27 One possible algorithm •

    Use quadrature to estimate the value of the integral which is the area under the curve. – π= 4 n ∑ i=1 n 1 1+( i−0.5 n ) 2 With n = 3 not much to do, but potentially lots of error. Use n = 107 or n = 109? Embarrassingly parallel.
  28. Copyright © 2014 Russel Winder 28 Because addition is commutative

    and associative, expression can be decomposed into sums of partial sums.
  29. Copyright © 2014 Russel Winder 29 a + b +

    c + d + e + f = ( a + b ) + ( c + d ) + ( e + f )
  30. Copyright © 2014 Russel Winder 30 Scatter Gather — map

    reduce data parallel
  31. Copyright © 2014 Russel Winder 31 Code!

  32. Copyright © 2014 Russel Winder 32 Scala Kotlin Ceylon

  33. Copyright © 2014 Russel Winder 33 ?

  34. Copyright © 2014 Russel Winder 34 Surprise time…

  35. Copyright © 2014 Russel Winder 35 JVM is a Groovy

    place
  36. Copyright © 2014 Russel Winder 36 Groovy • Top-level functions.

    • Object-oriented with functional features. • Extension methods. • Compiles to JVM bytes codes or JavaScript, cf. GrooScript. • Runs on Android. • Scripts. • A dynamic language with a run time meta-object protocol.
  37. Copyright © 2014 Russel Winder 37 Groovy A statically typed,

    compiled language.
  38. Copyright © 2014 Russel Winder 38 @TypeChecked @CompileStatic

  39. Copyright © 2014 Russel Winder 39 Groovy • @TypeChecked: •

    Traditional dynamic Groovy but with full static (compile-time) type checking. • @CompileStatic: • Full static typechecked, compilation to bytecode at compile time. • No dynamic meta- object protocol.
  40. Copyright © 2014 Russel Winder 40 Code!

  41. Copyright © 2014 Russel Winder 41

  42. Copyright © 2014 Russel Winder 42 Code!

  43. Copyright © 2014 Russel Winder 43 Did I mention invokedynamic?

  44. Copyright © 2014 Russel Winder 44 Code!

  45. Copyright © 2014 Russel Winder 45 Java is Dead!

  46. Copyright © 2014 Russel Winder 46 Groovy (or Scala, Kotlin,

    Ceylon, Fantom, ) … is the future of static languages on the JVM.
  47. Copyright © 2014 Russel Winder 47 2014-03-18

  48. Copyright © 2014 Russel Winder 48 Java 8 Released

  49. Copyright © 2014 Russel Winder 49 Java 8 is the

    biggest revolution in Java since 1994. Bigger than Java 5.
  50. Copyright © 2014 Russel Winder 50 Has Java revived? Is

    this a new lease of life?
  51. Copyright © 2014 Russel Winder 51 What's Interesting in Java

    8? • G1 garbage collector. • Nashorn. • JavaFX. • Lambda expressions. • Default methods in interfaces (traits). • Enhanced collections. • Method references.
  52. Copyright © 2014 Russel Winder 52 G1 garbage collector is

    now the standard: no more PermGen.
  53. Copyright © 2014 Russel Winder 53 Nashorn comes as standard:

    Server-side JavaScript without Rhino.
  54. Copyright © 2014 Russel Winder 54 JavaFX in the distribution:

    you will want to use GroovyFX though.
  55. Copyright © 2014 Russel Winder 55 Lambda expressions, default methods

    in interfaces, associated collections enhancements.
  56. Copyright © 2014 Russel Winder 56 Code!

  57. Copyright © 2014 Russel Winder 57

  58. Copyright © 2014 Russel Winder 58 Code!

  59. Copyright © 2014 Russel Winder 59 Java is Dead Long

    Live Scala, Kotlin, Ceylon, etc. Russel Winder email: russel@winder.org.uk twitter: @russel_winder Web: http://www.russel.org.uk
  60. Copyright © 2014 Russel Winder 60 Java is Dead Long

    Live Java Russel Winder email: russel@winder.org.uk twitter: @russel_winder Web: http://www.russel.org.uk
  61. Copyright © 2014 Russel Winder 61 Java is Dead Long

    Live Groovy Russel Winder email: russel@winder.org.uk twitter: @russel_winder Web: http://www.russel.org.uk