You are on page 1of 26

JRUBY ON RAILS

ON
GOOGLE APP ENGINE

martedì 13 luglio 2010


WHO WE ARE

Rivello Vincenzo
Software Engineer & Developer
Email: vincenzo.rivello@gmail.com
Twitter: enzoriv
Alessandro De Simone
Software Engineer & Developer
Email: alexdesi@gmail.com
Twitter: alexdesi

martedì 13 luglio 2010


INDEX

JRuby on Rails on Google App Engine

Introduction to Ruby/JRuby

Introduction to Ruby on Rails

JRoR on GAE - Pro/Against

Short Live Example

Conclusions

martedì 13 luglio 2010


JRUBY ON GOOGLE APP
ENGINE

With the newly support for Java, is now possible to


execute Ruby code on Google app Engine.

This thanks to a project that has the sole purpose to


simplify the use of JRuby for development on GAE
(like actually happen for Java and Python)

martedì 13 luglio 2010


WHY USE RUBY ON GAE?

Because maybe you already know Ruby

Because Ruby is powerful and flexible, engineered


more for persons rather than computers

Because it permits to use Ruby on Rails! (v 2.3.5


and , shortly, 3.0 fully)

martedì 13 luglio 2010


RUBY/JRUBY

martedì 13 luglio 2010


WHAT IS RUBY
Created in 1993 by Yukihiro “Matz” Matsumoto

General purpose scripting language

Completely Object Oriented

Inspired by Smalltalk , Lisp and Perl

Actually at the version 1.8.7(stable), and 1.9.1(with a


backward incompatibility)

With a young and creative community!

martedì 13 luglio 2010


WHAT IS JRUBY

Created by J.A. Petersen in 2001

JRuby is a Java implementation of the Ruby


programming language

Permits the union of Ruby’s elegance and Java’s


Ecosystem

Stable and Production Ready (version 1.5.1)

Actually is the faster Ruby implementation(between


200% to 500% more faster)

martedì 13 luglio 2010


EXAMPLE RUBY/JAVA

Language war has no sense.

Ruby is concise, readable and flexible

Java have great performance

JRuby permits to Ruby and Java to share a common


place, and unite for greater good!

martedì 13 luglio 2010


RUBY FOR JAVA DEVELOPERS

Ruby is interpreted
>ruby my_program.rb

Java is compiled
>javac MyProgram.java
>java MyProgram

martedì 13 luglio 2010


DYNAMIC TYPING USE

Variable doesn’t have an associated type


You don’t need to declare them
It is suffice to assign them:
a = [1,2,3]
instead of
int[] a = {1,2,3};

martedì 13 luglio 2010


RUBY IS CONCISE

Empty Program

Java Ruby

martedì 13 luglio 2010


RUBY IS CONCISE

Java

Ruby

martedì 13 luglio 2010


RUBY FRAMEWORKS

Is possible to write ruby code and execute it with


JRuby, and this permits us to create application on
GAE.

BUT, if we want to write a good web app in a short


time, we have to use a framework:
Ruby on Rails

Merb

Sinatra

martedì 13 luglio 2010


RUBY ON RAILS

martedì 13 luglio 2010


RUBY ON RAILS

RoR is an open-source framework , optimized for the


programmer’s happiness, and to make web developing
a fun and sustainable experience
With RoR you can program in a more immediate way,
thanks also to the “Convention Over Configuration”
paradigm.

martedì 13 luglio 2010


RUBY ON RAILS

Created by David Heinemeier Hesson (at 37 Signals)

Fully compliant on Agile Development standards

Complete development solution (from prototyping to


testing)

Favors communication inside the team(or between


teams)

Lots and lots of plugins for faster development

martedì 13 luglio 2010


PHILOSOPHY

Less and more readable code

No compilation cycle

Convention Over Configuration (almost no configuration file, predefined


directory structure)

Best practices: MVC, DRY(partial, helper, ...), Testing

Almost everything is Ruby(or Rails DSL) Code (Activerecord for SQL and
prototype for JavaScript)

Very active community, and great documentation (also video).

martedì 13 luglio 2010


JRUBY ON GAE

Project created by John Woodell and mantained by


JRuby community

Exploits Gae’s compatibility with Java to bring ruby


web development frameworks on GAE

Very simple setup.

Rething application on a key/value philosophy, instead


of relational.

martedì 13 luglio 2010


JRUBY ON GAE - PRO

Free Rails Hosting(and highly scalable)

Full integration with Java’s whitelist classes (on GAE)

Integration with Google services ecosystem

martedì 13 luglio 2010


JRUBY SU GAE - PRO 2

Great exercise to take confidence wit NoSql


databases

That’s because Bigtable is a Key/Value database,


similar to Redis or MongoDB, but more powerful.

martedì 13 luglio 2010


JRUBY ON GAE - AGAINST

Very HIGH instance creation time (10-15 seconds)

A little bit difficult at the beginning: you have to


accept the “Cloud Hosting” and decentralized
resources concept.

martedì 13 luglio 2010


LIVE EXAMPLE

martedì 13 luglio 2010


CONCLUSIONS

For us Rails developers, GAE is far-to-be a perfect


and stable solution for our hosting problems

But without any doubt, is something that we can


count on, expecially if you want to experience JRuby’s
world, and it’s interaction with Rails and GAE.

martedì 13 luglio 2010


RESOURCES AND
INFORMATIONS
Tutorial live:

http://jror-example.appspot.com

Source code:

http://github.com/enzor

More informations:

http://rails-primer.appspot.com/

martedì 13 luglio 2010


WE THANKS

martedì 13 luglio 2010

You might also like