Jug dynamic languages_in_jvm

Preview:

DESCRIPTION

 

Citation preview

Alternative Languages on JVM

Java User Group Latviawww.jug.lv

Agenda

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

o JRubyo Groovyo Scala

• Summary

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!!!

Why Go Alternative?

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

Why Go Alternative?

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

Where To Go?

• Dynamic Languageso JRubyo Jythono Groovyo Rhino (JavaScript)

• Functional Languageso Clojureo Scala

Groovy

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

JRuby

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

Scala

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

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

What about existing code?

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

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)

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 !

Where to Start?

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

Time for discussion

• Tell us what do you think

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

Who am I?

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

Reach me at buzdin@gmail.com