Top Banner
Ruby on Rails Thor Marius Henrichsen Frode Nerbråten
30

Ruby on Rails · 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

Apr 21, 2020

Download

Documents

dariahiddleston
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Ruby on Rails · 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

Ruby on RailsThor Marius Henrichsen

Frode Nerbråten

Page 2: Ruby on Rails · 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

Outline

• Ruby

• Ruby on Rails

• JRuby

• BEKK on Ruby on Rails

Page 3: Ruby on Rails · 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

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”

Page 4: Ruby on Rails · 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

Elegant syntax

Page 5: Ruby on Rails · 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
Page 6: Ruby on Rails · 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
Page 7: Ruby on Rails · 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

Ruby on Rails

• Open source MVC-based web framework

• Well suited for database-backed applications

• Rails gives you a pure-Ruby development environment

Page 8: Ruby on Rails · 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

Rails highlights

• Convention over configuration

• Flexibility

• Clean and DRY code

• High productivity

Page 9: Ruby on Rails · 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

Blog with comments

• Existing blog application without comments

• We will add

• a new table

• a new model and controller

• view markup

Page 10: Ruby on Rails · 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
Page 11: Ruby on Rails · 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

JRuby

Page 12: Ruby on Rails · 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

The old Java platform

Java

Libraries

JVM

Page 13: Ruby on Rails · 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
Page 14: Ruby on Rails · 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

The new Java platform

JavaDSL

Jython

JRuby

Javascript

Libraries

JVM

Page 15: Ruby on Rails · 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

Ruby Limitations• Green Threading

- No scaling across processors/cores

• Unicode support

- Partial and inconsistent

• Memory management

- Simple design

- Stop the world GC

Page 16: Ruby on Rails · 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

Ruby Limitations

• C Language extensions

- C is difficult

- Often needs recompilation

• Politics

- You want me to run what?

Page 17: Ruby on Rails · 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
Page 18: Ruby on Rails · 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

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

Page 19: Ruby on Rails · 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

Why JRuby

• Faster than MRI on most benchmarks

• Java can call Ruby

• Ruby can call Java

• Open java classes and add

- Methods

- Fields

Page 20: Ruby on Rails · 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
Page 21: Ruby on Rails · 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

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

Page 22: Ruby on Rails · 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

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

Page 23: Ruby on Rails · 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

Ruby @ BEKK

Page 24: Ruby on Rails · 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

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

Page 25: Ruby on Rails · 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

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!

Page 26: Ruby on Rails · 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

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

Page 27: Ruby on Rails · 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

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

Page 28: Ruby on Rails · 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

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

Page 29: Ruby on Rails · 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

Ruby on Rails makes developers happyand happy developers write better code

Page 30: Ruby on Rails · 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

Where can I learn more?

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