gtug-ENG

Embed Size (px)

Citation preview

  • 8/9/2019 gtug-ENG

    1/26

    JRUBY ON RAILSONGOOGLE APP ENGINE

    marted 13 luglio 2010

  • 8/9/2019 gtug-ENG

    2/26

    WHO WE ARE

    Rivello Vincenzo

    Email: [email protected]: enzoriv

    Alessandro De Simone

    Email: [email protected]

    Twitter: alexdesi

    Software Engineer & Developer

    Software Engineer & Developer

    marted 13 luglio 2010

    mailto:[email protected]:[email protected]
  • 8/9/2019 gtug-ENG

    3/26

    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

  • 8/9/2019 gtug-ENG

    4/26

    JRUBY ON GOOGLE APPENGINE

    With the newly support for Java, is now possible toexecute 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

  • 8/9/2019 gtug-ENG

    5/26

    WHY USE RUBY ON GAE?

    Because maybe you already know Ruby

    Because Ruby is powerful and flexible, engineeredmore for persons rather than computers

    Because it permits to use Ruby on Rails! (v 2.3.5and , shortly, 3.0 fully)

    marted 13 luglio 2010

  • 8/9/2019 gtug-ENG

    6/26

    RUBY/JRUBY

    marted 13 luglio 2010

  • 8/9/2019 gtug-ENG

    7/26

    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 abackward incompatibility)

    With a young and creative community!

    marted 13 luglio 2010

  • 8/9/2019 gtug-ENG

    8/26

    WHAT IS JRUBY

    Created by J.A. Petersen in 2001

    JRuby is a Java implementation of the Ruby

    programming language

    Permits the union of Rubys elegance and JavasEcosystem

    Stable and Production Ready (version 1.5.1)

    Actually is the faster Ruby implementation(between200% to 500% more faster)

    marted 13 luglio 2010

  • 8/9/2019 gtug-ENG

    9/26

    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 commonplace, and unite for greater good!

    marted 13 luglio 2010

  • 8/9/2019 gtug-ENG

    10/26

    RUBY FOR JAVA DEVELOPERS

    Ruby is interpreted

    >ruby my_program.rb

    Java is compiled>javac MyProgram.java

    >java MyProgram

    marted 13 luglio 2010

  • 8/9/2019 gtug-ENG

    11/26

    DYNAMIC TYPING USE

    Variable doesnt have an associated type

    You dont need to declare themIt is suffice to assign them:a = [1,2,3]instead of

    int[] a = {1,2,3};

    marted 13 luglio 2010

  • 8/9/2019 gtug-ENG

    12/26

    RUBY IS CONCISE

    Empty Program

    RubyJava

    marted 13 luglio 2010

  • 8/9/2019 gtug-ENG

    13/26

    RUBY IS CONCISE

    Java

    Ruby

    marted 13 luglio 2010

  • 8/9/2019 gtug-ENG

    14/26

    RUBY FRAMEWORKS

    Is possible to write ruby code and execute it withJRuby, and this permits us to create application on

    GAE.

    BUT, if we want to write a good web app in a shorttime, we have to use a framework:

    Ruby on Rails

    Merb

    Sinatra

    marted 13 luglio 2010

  • 8/9/2019 gtug-ENG

    15/26

    RUBY ON RAILS

    marted 13 luglio 2010

  • 8/9/2019 gtug-ENG

    16/26

    RUBY ON RAILS

    RoR is an open-source framework , optimized for the

    programmers happiness, and to make web developinga fun and sustainable experienceWith RoR you can program in a more immediate way,thanks also to the Convention Over Configuration

    paradigm.

    marted 13 luglio 2010

  • 8/9/2019 gtug-ENG

    17/26

    RUBY ON RAILS

    Created by David Heinemeier Hesson (at 37 Signals)

    Fully compliant on Agile Development standards

    Complete development solution (from prototyping totesting)

    Favors communication inside the team(or betweenteams)

    Lots and lots of plugins for faster development

    marted 13 luglio 2010

  • 8/9/2019 gtug-ENG

    18/26

    PHILOSOPHY

    Less and more readable code

    No compilation cycle

    Convention Over Configuration (almost no configuration file, predefineddirectory structure)

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

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

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

    marted 13 luglio 2010

  • 8/9/2019 gtug-ENG

    19/26

    JRUBY ON GAE

    Project created by John Woodell and mantained byJRuby community

    Exploits Gaes compatibility with Java to bring rubyweb development frameworks on GAE

    Very simple setup.

    Rething application on a key/value philosophy, insteadof relational.

    marted 13 luglio 2010

  • 8/9/2019 gtug-ENG

    20/26

    JRUBY ON GAE - PRO

    Free Rails Hosting(and highly scalable)

    Full integration with Javas whitelist classes (on GAE)

    Integration with Google services ecosystem

    marted 13 luglio 2010

  • 8/9/2019 gtug-ENG

    21/26

    JRUBY SU GAE - PRO 2

    Great exercise to take confidence wit NoSqldatabases

    Thats because Bigtable is a Key/Value database,

    similar to Redis or MongoDB, but more powerful.

    marted 13 luglio 2010

  • 8/9/2019 gtug-ENG

    22/26

    JRUBY ON GAE - AGAINST

    Very HIGH instance creation time (10-15 seconds)

    A little bit difficult at the beginning: you have toaccept the Cloud Hosting and decentralized

    resources concept.

    marted 13 luglio 2010

  • 8/9/2019 gtug-ENG

    23/26

    LIVE EXAMPLE

    marted 13 luglio 2010

  • 8/9/2019 gtug-ENG

    24/26

    CONCLUSIONS

    For us Rails developers, GAE is far-to-be a perfectand stable solution for our hosting problems

    But without any doubt, is something that we can

    count on, expecially if you want to experience JRubysworld, and its interaction with Rails and GAE.

    marted 13 luglio 2010

  • 8/9/2019 gtug-ENG

    25/26

    RESOURCES ANDINFORMATIONS

    Tutorial live:

    http://jror-example.appspot.com

    Source code:

    http://github.com/enzor

    More informations:

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

    marted 13 luglio 2010

    http://rails-primer.appspot.com/http://rails-primer.appspot.com/http://github.com/enzorhttp://jror-example.appspot.com/http://rails-primer.appspot.com/http://rails-primer.appspot.com/http://github.com/enzorhttp://github.com/enzorhttp://jror-example.appspot.com/http://jror-example.appspot.com/
  • 8/9/2019 gtug-ENG

    26/26

    WE THANKS