jruby in a java world

9
JRuby in a Java World Sneaking JRuby in the Backdoor by Mark Menard, Vita Rara, Inc.

Post on 12-Sep-2014

1.346 views

Category:

Technology


0 download

DESCRIPTION

Brief overview of using JRuby in a Java shop. Covers

TRANSCRIPT

Page 1: JRuby in a Java World

JRuby in a Java WorldSneaking JRuby in the Backdoorby Mark Menard, Vita Rara, Inc.

Page 2: JRuby in a Java World

© 2004 Vita Rara, Inc.

JRuby

JRuby is an implementation of Ruby that runs on the Java Virtual Machine. Can use Java classes. Supports embedding into Java applications.

Allows testing of Java code using Ruby tools such as: RSpec Cucumber

Support is coming for creating Java classes.

Page 3: JRuby in a Java World

© 2004 Vita Rara, Inc.

JRuby for Java Developers

A dynamically typed object oriented language.

Supports open classes and meta-programming.

Terse syntax with low ceremony. High developer productivity. Has support for closures. Is focused on developer joy.

Page 4: JRuby in a Java World

© 2004 Vita Rara, Inc.

JRuby on Rails

Ruby on Rails A highly productive Ruby web framework focusing on convention over configuration, and DRY (Don’t Repeat Yourself).

Used in many high volume Software as a Service applications. Basecamp Lighthouse App

Branching out into more consumer oriented websites. Yellowpages.com Slideshare.net

Page 5: JRuby in a Java World

© 2004 Vita Rara, Inc.

JRuby in a Java House

Prototyping Testing Intranet Applications CRUD Script Existing Java Resources

Page 6: JRuby in a Java World

© 2004 Vita Rara, Inc.

Language per Tier

Use appropriate language per tier of your application.

We’re all polyglots! Model

Java, Groovy++ or Scala for performance

Ruby, Groovy or Python for expressiveness

Controller Use a dynamic language

View JSP, Velocity, ERB, Groovy, Javascript

Page 7: JRuby in a Java World

© 2004 Vita Rara, Inc.

Greenfield Development

JRuby on Rails runs on the JVM and can be deployed in most Java application servers.

Packaging is easy via Warbler gem. Consider this if you have a simple proof of concept project.

Page 8: JRuby in a Java World

© 2004 Vita Rara, Inc.

Brownfield Development

How many greenfields are there really?

Strategies Script existing domain models. Use as scripting language for business rules.

Embed Rails app in existing Java web app.

Use Cucumber to test existing web app.

Use RSpec to test existing Java code.

Page 9: JRuby in a Java World

© 2004 Vita Rara, Inc.

Sneaking Rails in the Backdoor

Embed a Rails app inside an existing Java web application. Add JRuby dependencies Add jruby-rack handler to web.xml Create Rails application in project. Integrate packaging of Rails app into build process. Can be in a subdirectory of /WEB-INF, or Can be integrated into the / of the web application.