30
Ruby on Rails Thor Marius Henrichsen Frode Nerbråten

Ruby on Rails - Universitetet i Oslo · Ruby on Rails • Open source MVC-based web framework • Well suited for database-backed applications • Rails gives you a pure-Ruby development

  • Upload
    dinhdan

  • View
    223

  • Download
    0

Embed Size (px)

Citation preview

Ruby on RailsThor Marius Henrichsen

Frode Nerbråten

Outline

• Ruby

• Ruby on Rails

• JRuby

• BEKK on Ruby on Rails

What is Ruby?

• elegant and natural syntax

• focus on productivity

• roots from Lisp, Perl and SmallTalk

A dynamic object oriented programming language with:

Written by Yukihiro Matsumoto, or just “Matz”

Elegant syntax

Ruby on Rails

• Open source MVC-based web framework

• Well suited for database-backed applications

• Rails gives you a pure-Ruby development environment

Rails highlights

• Convention over configuration

• Flexibility

• Clean and DRY code

• High productivity

Blog with comments

• Existing blog application without comments

• We will add

• a new table

• a new model and controller

• view markup

JRuby

The old Java platform

Java

Libraries

JVM

The new Java platform

JavaDSL

Jython

JRuby

Javascript

Libraries

JVM

Ruby Limitations• Green Threading

- No scaling across processors/cores

• Unicode support

- Partial and inconsistent

• Memory management

- Simple design

- Stop the world GC

Ruby Limitations

• C Language extensions

- C is difficult

- Often needs recompilation

• Politics

- You want me to run what?

Why JRuby

• Scalability through native threading

• Better memory and GC management

• Native unicode support

- A must for web applications

• Enterprise acceptable

- It’s just a Java library

Why JRuby

• Faster than MRI on most benchmarks

• Java can call Ruby

• Ruby can call Java

• Open java classes and add

- Methods

- Fields

JRuby on Rails • Deployment on most Java servers

- A simple servlet container will do

• Java is a proven web application platform

- Addresses a bunch of difficult issues

• WAR deployment

- Transparent for sysadmins

- Easy distribution

• Utilizing server features

- Scaling, Connection pooling

JRuby Limitations • Native libraries

- But decent ports exists

• Startup

- Use MRI for development

• Missing File operations

- Limited to what’s provided by the JVM

• Maturity

- Version 1.0 released June 2007

Ruby @ BEKK

Ruby @ BEKK

• Completed 2 Ruby on Rails projects

• Dedicated competency group

• Contributers to Ruby open source projects

• Rails, JRuby, Rspec, Cucumber, +++

• Represented on Ruby/Rails conferences worldwide

Why Ruby

• Ruby on Rails is over the hype

• JRuby makes Rails an eligble alternative for some of our customers

• Growing interest among employees

• Happy developers write better code!

• Ruby lends it self to practices of agile development

• Testing at all levels is easy and fun!

Project Experience - Background

• Rewrite project for long term customer

• Java based legacy solution

• Huge code base

• Duplicate code

• Modified over 10 years

• No automated test suite

• Frequent change requests

• Regressions

Project Experience - Technology

• MRI Ruby in test/development environments

• JRuby on Glassfish Application Server in production environment

• Rails 2.1

• Legacy database with a view layer to support Rails conventions

• Rspec, RubyFIT, Watir

Project Experience - Outcome

Language: JavaNorway: 50 000 LOCDenmark : 50 000 LOCAutomated tests: 0 LOCTotal : 100 000 LOC

Language: Ruby Total: 3 835 LOCAutomated tests: 10 418 LOC Total: 14 253 LOC

Result

Originally

4 developers approx. 6 months

Ruby on Rails makes developers happyand happy developers write better code

Where can I learn more?

http://ruby-lang.org http://rubyonrails.orghttp://jruby.org