17
Alternative Languages on JVM Java User Group Latvia www.jug.lv

Jug dynamic languages_in_jvm

Embed Size (px)

DESCRIPTION

 

Citation preview

Page 1: Jug dynamic languages_in_jvm

Alternative Languages on JVM

Java User Group Latviawww.jug.lv

Page 2: Jug dynamic languages_in_jvm

Agenda

• Why alternative languages?• What are the options?• How to use them? • Meet today's leaders

o JRubyo Groovyo Scala

• Summary

Page 3: Jug dynamic languages_in_jvm

Why Go Alternative?

• Java is stagnating • Syntax• Complex language - generics example?• Technical limitations• Ugly API • JDK 7/8 is being delayed• We want power now!!!

Page 4: Jug dynamic languages_in_jvm

Why Go Alternative?

• Generics• Primitives• Arrays• Date API• I/O API• No closures

Page 5: Jug dynamic languages_in_jvm

Why Go Alternative?

• Cool frameworks and libraries• Embedded scripting• Less code• Simple code

Page 6: Jug dynamic languages_in_jvm

Where To Go?

• Dynamic Languageso JRubyo Jythono Groovyo Rhino (JavaScript)

• Functional Languageso Clojureo Scala

Page 7: Jug dynamic languages_in_jvm

Groovy

• Easiest to learn • Direct invocation of Java methods• Compilable• Java only• Grails, Gradle, Gant, Griffon, GPars, ...• Markup builder example...   

Page 8: Jug dynamic languages_in_jvm

JRuby

• Different from Java• Intuitive syntax• Several implementations (Native, IronRuby, ...) • Compilable • Rails, Rake, Ruby Gems, ...• Active Record example

Page 9: Jug dynamic languages_in_jvm

Scala

• Functional and object-oriented • Concurrency• Academic• Java only • Lift • Prime numbers example ...

Page 10: Jug dynamic languages_in_jvm

How it works?

• Interpreted o JDK 6 JSR 223 (javax.script) (Example)o Apache Bean Scripting Framework (BSF)o Custom script runners

• Compilation into bytecodeo Best performance

Page 11: Jug dynamic languages_in_jvm

What about existing code?

• Calls to Java• Calls from Java• Class extensions (example)• Hybrid systems

Page 12: Jug dynamic languages_in_jvm

JVM and Java Language

• JVM and Java are not the same thing• Java used with no JVM (Android, GWT)• JVM used with no Java (JVM languages)

Page 13: Jug dynamic languages_in_jvm

Summary

• One language is not enough • No changes to infrastructure• Don't treat Java as a hammer • No need to drop Java• Simply try it !

Page 14: Jug dynamic languages_in_jvm

Where to Start?

• Try Groovy• Easiest Java integration• Compilation into bytecode• Lots of frameworks

Page 15: Jug dynamic languages_in_jvm

Time for discussion

• Tell us what do you think

Page 16: Jug dynamic languages_in_jvm

References

http://jruby.org/http://groovy.codehaus.org/ http://www.scala-lang.org/ http://jakarta.apache.org/bsf/http://jcp.org/en/jsr/detail?id=223

Page 17: Jug dynamic languages_in_jvm

Who am I?

Dmitry Buzdin  Agile software developer working with Java since 2005Based in C.T.Co

Reach me at [email protected]