SlideShare a Scribd company logo
Ruby for Java
Developers
!

Robert Reiz
Robert Reiz

http:/
/robert-reiz.com

https:/
/twitter.com/robertreiz

!

http:/
/about.me/robertreiz

!

http:/
/www.VersionEye.com
Agenda
History

Java/Ruby Culture Background

Java/Ruby Tech. Background

Ruby Lang

Rails - Short Intro + Tools

Rails Demo App 

Performance 

Else

The End
A Presentation is no
Documentation
A good presentation supports only the speaker
History

Yukihiro Matsumoto in Japan

1993 first ideas

1995 Version 0.95 released
History
"I wanted a scripting language that was more
powerful than Perl, and more object-oriented
than Python. That's why I decided to design my
own language."
- Matsumoto
History
"Often people, especially computer engineers, focus on
the machines. They think, "By doing this, the machine
will run faster. By doing this, the machine will run more
effectively. By doing this, the machine will something
something something." They are focusing on machines.
But in fact we need to focus on humans, on how humans
care about doing programming or operating the
application of the machines. We are the masters. They
are the slaves."
- Matsumoto
History
for (int i = 0 ; i < 3 ; i++){

System.out.println(“Hallo World”);

}
3.times{

print “Hallo World”

}
History
Language developed by Open Standards
Promotion Center of the InformationTechnology Promotion Agency 

2011: Japanese Industrial Standard (JIS X
3017)

2012: International standard (ISO/IEC 30170)
Culture Background
“Java Programmers are writing strange
Ruby Code.”
Java Culture
JME


Java for Desktops
(Swing, AWT,
JavaFX)


J EE
Java Culture = Enterprise Culture

Enterprise Environment
Java Culture
Waterfall
Servlet
LDAP
Intranet

Eclipse

Excel

Application Server
Oracle

Jira

Deadlines
Outlook

Requirements

SVN
SLAs

EJB
Ruby Culture

Start-Up Culture in Silicon Valley
Ruby Culture

Start-Up Environment (Epicenter Cafe @ SF)
Ruby Culture

Start-Up Environment (The Summit @ SF)
Ruby Culture

Hackathon
Fail fast
Fail early
Ruby Culture
Login with Twitter / Facebook
OAuth

Cloud

Internet
GMail

SaaS

Agile

PostgreSQL
SimpleNote
RTM

Heroku

NoSQL

Textmate
Dropbox
Ideas

GitHub
Java Tech. Background
WAR

EAR

WAR

EAR

WAR

App-Server
DB

SAP

LDAP

This makes sense for big companies with different apartments. 

But it doesn’t make sense for a small Start-Up!
Ruby Tech. Background
In a typical Ruby environment there is usually ...
No SAP

No LDAP

No Oracle

No App-Server

No WAR

No EAR
Ruby Tech. Background
Just the App!

Application
Everything else is secondary!
Java Language

640 Pages
Java Language
Inheritance
Polymorphismus
AutoBoxing

Interfaces

Object Oriented

Annotations
Generics

static typing

Enums
Java Language
More language features don’t make a language
better. Just more complicated and more difficult
to learn.
Without monster tools like Eclipse it is nearly not
possible to use the language.
Can you write down the Java code to open this
file and output the content? 

!

- Without IDE

- Without Google

text_file.txt
Java
import java.io.*;


!
class FileRead {



public static void main(String args[]) {

try{

FileInputStream fstream = new FileInputStream("text_file.txt");

DataInputStream in = new DataInputStream(fstream);

BufferedReader br = new BufferedReader(new InputStreamReader(in));

String strLine;

while ((strLine = br.readLine()) != null) {

System.out.println (strLine);

}

in.close();

} catch (Exception e) { 

System.err.println("Error: " + e.getMessage());

}

}

}
Ruby
puts File.read 'text_file.txt'
Python
f = open('text_file.txt', 'r')

Perl
open FILE, "text_file.txt" or die $!;
Ruby Language
Polymorphismus

Inheritance

Object Oriented
Duck typing

dynamic typing
Ruby Language
No Interfaces

No static types

No Generics 

No Annotations
Java

Ruby

package xyz;

!

import xyz;

!

public class User {

!

public void sayHello(){

System.out.println(“Hello”);

}

!

class User 

!

def say_hello

p “Hello”

end

!

}

end

User user = new User()

user.sayHello()

user = User.new

user.say_hello
Java

Ruby

package xyz;

!

import xyz;

!

class User 

!

def say_hello

p “Hello”

end


public class User {

!

public void sayHello(){

System.out.println(“Hello”);

}


!

private 

!

!

private String secretHero(){

return “secret hero”;

}

!

}

def secret_hero

“secret hero”

end

!

end
Java
public String doubleIt(String name){

result = name + “ ” + name;

return result;

}

Ruby
def double_it name

"#{name} #{name}"

end
Java
public String greetz(String name){ 

if (name != null){

result = “Hello” + name;

else {

result = “Hello”; 

}

System.out.println( result );

}
Ruby
def greetz( name )

if !name.nil?

p "Hello #{name}"

else

p “Hello” 

end

end
Ruby
def greetz(name)

p "Hello #{name}" if name

p “Hello” unless name

end
Ruby
def greetz(name = “Rob”, say_name = true)

p "Hello #{name}" if say_name

p “Hello” unless say_name

end

user.greetz(“Bob”, false)
user. greetz(“Bob”)
user. greetz()
Java
List<String> list = new ArrayList<String>();

!

list.add("Spiderman");

list.add("Batman");

list.add("Hulk");

!

for (String name : list){

System.out.println(name);

}
Ruby
names = Array.new
names << “Hans”

names << “Tanz”
names[0]

names[1]
names.first
names.last
Ruby
names = [‘Spiderman’, ‘Batman’, ‘Hulk’]
names.each do |name|

print “#{name}”

end
Ruby
hash = Hash.new
hash[“a”] = 100

hash[“b”] = 200
hash[“a”]

hash.delete(“a”)
hash.first
hash.last
hash.each {|key, value| puts "#{key} is #{value}" }
hash.each_key {|key| puts key }
irb
Ruby on Rails
Initial Release 2004

David Heinemeier Hansson

Web application framework

MIT License

http:/
/rubyonrails.org/
Ruby on Rails
activesupport : 3.2.8 

bundler : ~>1.0 

activerecord : 3.2.8 

actionpack : 3.2.8 

activeresource : 3.2.8 

actionmailer : 3.2.8

railties : 3.2.8
http:/
/www.versioneye.com/package/rails
Ruby on Rails
MVC Framework

Convention over Configuration

KIS 

Testable 

No UI Components 

You are in control
Ruby on Rails

REST

Stateless

Session in cookies OR database
Ruby on Rails

http:/
/www.myapp.com/photos
http:/
/www.myapp.com/photos/17
http:/
/www.myapp.com/photos/17/edit
Bundler - Gemfile
source 'https:/
/rubygems.org'

!

gem 'rails', '3.2.6'

gem 'sqlite3'

gem 'jquery-rails'

!

# Gems used only for assets and not required

# in production environments by default.

group :assets do

gem 'sass-rails', '~> 3.2.3'

gem 'coffee-rails', '~> 3.2.1'

gem 'uglifier', '>= 1.0.3'

end
Environments
development:

adapter: sqlite3

database: db/development.sqlite3

pool: 5

timeout: 5000


!
test:

adapter: sqlite3

database: db/test.sqlite3

pool: 5

timeout: 5000


!
production:

adapter: sqlite3

database: db/production.sqlite3

pool: 5

timeout: 5000


export RAILS_ENV=test
export RAILS_ENV=production
export RAILS_ENV=development
Rake
require File.expand_path('../config/application', __FILE__)

!

Myapp::Application.load_tasks


rake db:create
rake routes
Ruby on Rails

DEMO
live coding
Performance
Ruby is slower than Java! 

!

... True!
But ...
Performance

Client

Request
Response

WEB

Server

40 %

20 %

READ, WRITE
Response

40 %

DB
Performance
Request
Response

1
HTML

Page

WEB

Server
N - Requests 

to load 

additional 

Resources
Performance
Performance
Performance
Performance opt. for Web Apps. 

Minify

Uglify

CSS Stripes

Opt. HTML

Opt. Database Access
Performance

http:/
/guides.rubyonrails.org/asset_pipeline.html

http:/
/tools.pingdom.com/fpt/
Who is using Ruby?
Ruby is just good small projects. Right?
-> Right!
Small Projects like ...
-> $ 800 Million worth
-> $ 1 Billion worth
Count of Open Source Projects

Java

Java
Ruby

PHP
0

12500

25000

37500

50000

4061

PHP

R

12320

R

Node.JS

23439

Node.JS

Python

43620

Python

Ruby

48034

2973
Ruby on Rails is very
good solution for WebApplications!
What is not good for?
It is not good for ...

Long living batch jobs

parsing 2 million documents

Use Java or C for that kind of jobs.
Links
http:/
/www.ruby-lang.org/en/

http:/
/rubyonrails.org

http:/
/ruby.railstutorial.org

http:/
/rubygems.org/

http:/
/www.heroku.com

http:/
/travis-ci.org
Links
http:/
/www.engineyard.com/

https:/
/www.dotcloud.com/

http:/
/www.CloudControl.com/

http:/
/jruby.org/

http:/
/www.ironruby.net/
???

More Related Content

What's hot (11)

PPT
ppt18
callroom
 
PPT
Ruby for Perl Programmers
amiable_indian
 
PPT
name name2 n
callroom
 
PDF
The Sincerest Form of Flattery
José Paumard
 
PPT
Javascript
guest03a6e6
 
PDF
Effective Scala (JavaDay Riga 2013)
mircodotta
 
PDF
DEFUN 2008 - Real World Haskell
Bryan O'Sullivan
 
PPT
Groovy presentation
Manav Prasad
 
PPTX
Php extensions
Elizabeth Smith
 
PDF
Playfulness at Work
Erin Dees
 
PPTX
The Sincerest Form of Flattery
José Paumard
 
ppt18
callroom
 
Ruby for Perl Programmers
amiable_indian
 
name name2 n
callroom
 
The Sincerest Form of Flattery
José Paumard
 
Javascript
guest03a6e6
 
Effective Scala (JavaDay Riga 2013)
mircodotta
 
DEFUN 2008 - Real World Haskell
Bryan O'Sullivan
 
Groovy presentation
Manav Prasad
 
Php extensions
Elizabeth Smith
 
Playfulness at Work
Erin Dees
 
The Sincerest Form of Flattery
José Paumard
 

Viewers also liked (20)

PPT
Java vs. Ruby
Bryan Rojas
 
PPTX
Ruby conf 2016 - Secrets of Testing Rails 5 Apps
Nascenia IT
 
PDF
«Работа с базами данных с использованием Sequel»
Olga Lavrentieva
 
PPTX
Apresentação sobre JRuby
Régis Eduardo Weizenmann Gregol
 
PDF
Seu site voando
Maurício Linhares
 
KEY
Beginner's Sinatra
Tomokazu Kiyohara
 
PPT
Criação de uma equipe de QAs, do Waterfall ao Agile
Robson Agapito Correa
 
PPT
QA Automation Battle: Java vs Python vs Ruby [09.04.2015]
GoIT
 
PPTX
Monitorama - Please, no more Minutes, Milliseconds, Monoliths or Monitoring T...
Adrian Cockcroft
 
ODP
Jruby, o melhor de 2 mundos (MacGyver + ChuckNorris)
Marcio Sfalsin
 
PPTX
Ruby object model
Chamnap Chhorn
 
KEY
Advanced Ruby Idioms So Clean You Can Eat Off Of Them
Brian Guthrie
 
PDF
Object-Oriented BDD w/ Cucumber by Matt van Horn
Solano Labs
 
PDF
[38º GURU SP] Automação de Testes Web em Ruby com Cucumber e Webdriver
Júlio de Lima
 
PDF
Docker Introduction
Robert Reiz
 
PDF
Ruby vs Java
Belighted
 
PDF
Ruby on Rails for beginners
Vysakh Sreenivasan
 
PDF
How to Teach Yourself to Code
Mattan Griffel
 
PDF
Tic crónicas estudiantes
Edison Wilmer Rengifo Díaz
 
PPTX
Bubbl us-2
Rene Torres Visso
 
Java vs. Ruby
Bryan Rojas
 
Ruby conf 2016 - Secrets of Testing Rails 5 Apps
Nascenia IT
 
«Работа с базами данных с использованием Sequel»
Olga Lavrentieva
 
Apresentação sobre JRuby
Régis Eduardo Weizenmann Gregol
 
Seu site voando
Maurício Linhares
 
Beginner's Sinatra
Tomokazu Kiyohara
 
Criação de uma equipe de QAs, do Waterfall ao Agile
Robson Agapito Correa
 
QA Automation Battle: Java vs Python vs Ruby [09.04.2015]
GoIT
 
Monitorama - Please, no more Minutes, Milliseconds, Monoliths or Monitoring T...
Adrian Cockcroft
 
Jruby, o melhor de 2 mundos (MacGyver + ChuckNorris)
Marcio Sfalsin
 
Ruby object model
Chamnap Chhorn
 
Advanced Ruby Idioms So Clean You Can Eat Off Of Them
Brian Guthrie
 
Object-Oriented BDD w/ Cucumber by Matt van Horn
Solano Labs
 
[38º GURU SP] Automação de Testes Web em Ruby com Cucumber e Webdriver
Júlio de Lima
 
Docker Introduction
Robert Reiz
 
Ruby vs Java
Belighted
 
Ruby on Rails for beginners
Vysakh Sreenivasan
 
How to Teach Yourself to Code
Mattan Griffel
 
Tic crónicas estudiantes
Edison Wilmer Rengifo Díaz
 
Bubbl us-2
Rene Torres Visso
 
Ad

Similar to Ruby for Java Developers (20)

PPT
Java, Ruby & Rails
Peter Lind
 
PDF
Ruby an overall approach
Felipe Schmitt
 
PPTX
Why Ruby?
IT Weekend
 
KEY
Ruby on Rails Training - Module 1
Mark Menard
 
PDF
Workin On The Rails Road
RubyOnRails_dude
 
PPTX
Optimizing for programmer happiness
Josh Schramm
 
PDF
From Java to Ruby...and Back
Anil Hemrajani
 
PPT
Workin ontherailsroad
Jim Jones
 
PPT
WorkinOnTheRailsRoad
webuploader
 
PPT
Rapid Application Development using Ruby on Rails
Simobo
 
ZIP
Meta Programming in Ruby - Code Camp 2010
ssoroka
 
KEY
Introduction to Ruby
Mark Menard
 
PPTX
Day 1 - Intro to Ruby
Barry Jones
 
PDF
JRuby + Rails = Awesome Java Web Framework at Jfokus 2011
Nick Sieger
 
PPTX
Adventures of java developer in ruby world
Orest Ivasiv
 
PPT
Introduction to Ruby on Rails
mithunsasidharan
 
PPTX
Ruby for .NET developers
Max Titov
 
PDF
IJTC%202009%20JRuby
tutorialsruby
 
PDF
IJTC%202009%20JRuby
tutorialsruby
 
PDF
Introduction to Ruby & Modern Programming
Christos Sotirelis
 
Java, Ruby & Rails
Peter Lind
 
Ruby an overall approach
Felipe Schmitt
 
Why Ruby?
IT Weekend
 
Ruby on Rails Training - Module 1
Mark Menard
 
Workin On The Rails Road
RubyOnRails_dude
 
Optimizing for programmer happiness
Josh Schramm
 
From Java to Ruby...and Back
Anil Hemrajani
 
Workin ontherailsroad
Jim Jones
 
WorkinOnTheRailsRoad
webuploader
 
Rapid Application Development using Ruby on Rails
Simobo
 
Meta Programming in Ruby - Code Camp 2010
ssoroka
 
Introduction to Ruby
Mark Menard
 
Day 1 - Intro to Ruby
Barry Jones
 
JRuby + Rails = Awesome Java Web Framework at Jfokus 2011
Nick Sieger
 
Adventures of java developer in ruby world
Orest Ivasiv
 
Introduction to Ruby on Rails
mithunsasidharan
 
Ruby for .NET developers
Max Titov
 
IJTC%202009%20JRuby
tutorialsruby
 
IJTC%202009%20JRuby
tutorialsruby
 
Introduction to Ruby & Modern Programming
Christos Sotirelis
 
Ad

More from Robert Reiz (12)

PDF
Silicon Valley vs. Berlin vs. Mannheim
Robert Reiz
 
PDF
Go with Go
Robert Reiz
 
PDF
Infrastructure Deployment with Docker & Ansible
Robert Reiz
 
PDF
Dependencies and Licenses
Robert Reiz
 
PDF
Ansible Introduction
Robert Reiz
 
PDF
Continuous Updating with VersionEye at code.talks 2014
Robert Reiz
 
PDF
Api Days Berlin - Continuous Updating
Robert Reiz
 
PDF
Gruenden indercloud
Robert Reiz
 
PDF
Continuous Updating
Robert Reiz
 
PDF
VersionEye for PHP User Group Berlin
Robert Reiz
 
KEY
Silicon Valley
Robert Reiz
 
PDF
Software Libraries And Numbers
Robert Reiz
 
Silicon Valley vs. Berlin vs. Mannheim
Robert Reiz
 
Go with Go
Robert Reiz
 
Infrastructure Deployment with Docker & Ansible
Robert Reiz
 
Dependencies and Licenses
Robert Reiz
 
Ansible Introduction
Robert Reiz
 
Continuous Updating with VersionEye at code.talks 2014
Robert Reiz
 
Api Days Berlin - Continuous Updating
Robert Reiz
 
Gruenden indercloud
Robert Reiz
 
Continuous Updating
Robert Reiz
 
VersionEye for PHP User Group Berlin
Robert Reiz
 
Silicon Valley
Robert Reiz
 
Software Libraries And Numbers
Robert Reiz
 

Recently uploaded (20)

PDF
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
PPTX
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
DOCX
Python coding for beginners !! Start now!#
Rajni Bhardwaj Grover
 
PDF
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
PDF
How do you fast track Agentic automation use cases discovery?
DianaGray10
 
PPTX
Future Tech Innovations 2025 – A TechLists Insight
TechLists
 
PDF
Automating Feature Enrichment and Station Creation in Natural Gas Utility Net...
Safe Software
 
PPTX
Designing_the_Future_AI_Driven_Product_Experiences_Across_Devices.pptx
presentifyai
 
PDF
Mastering Financial Management in Direct Selling
Epixel MLM Software
 
PDF
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 
PPTX
Seamless Tech Experiences Showcasing Cross-Platform App Design.pptx
presentifyai
 
PDF
“Voice Interfaces on a Budget: Building Real-time Speech Recognition on Low-c...
Edge AI and Vision Alliance
 
PDF
LOOPS in C Programming Language - Technology
RishabhDwivedi43
 
PPTX
COMPARISON OF RASTER ANALYSIS TOOLS OF QGIS AND ARCGIS
Sharanya Sarkar
 
PDF
UPDF - AI PDF Editor & Converter Key Features
DealFuel
 
PDF
“Squinting Vision Pipelines: Detecting and Correcting Errors in Vision Models...
Edge AI and Vision Alliance
 
PDF
Transforming Utility Networks: Large-scale Data Migrations with FME
Safe Software
 
PDF
“NPU IP Hardware Shaped Through Software and Use-case Analysis,” a Presentati...
Edge AI and Vision Alliance
 
PPTX
MuleSoft MCP Support (Model Context Protocol) and Use Case Demo
shyamraj55
 
PDF
The 2025 InfraRed Report - Redpoint Ventures
Razin Mustafiz
 
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
Python coding for beginners !! Start now!#
Rajni Bhardwaj Grover
 
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
How do you fast track Agentic automation use cases discovery?
DianaGray10
 
Future Tech Innovations 2025 – A TechLists Insight
TechLists
 
Automating Feature Enrichment and Station Creation in Natural Gas Utility Net...
Safe Software
 
Designing_the_Future_AI_Driven_Product_Experiences_Across_Devices.pptx
presentifyai
 
Mastering Financial Management in Direct Selling
Epixel MLM Software
 
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 
Seamless Tech Experiences Showcasing Cross-Platform App Design.pptx
presentifyai
 
“Voice Interfaces on a Budget: Building Real-time Speech Recognition on Low-c...
Edge AI and Vision Alliance
 
LOOPS in C Programming Language - Technology
RishabhDwivedi43
 
COMPARISON OF RASTER ANALYSIS TOOLS OF QGIS AND ARCGIS
Sharanya Sarkar
 
UPDF - AI PDF Editor & Converter Key Features
DealFuel
 
“Squinting Vision Pipelines: Detecting and Correcting Errors in Vision Models...
Edge AI and Vision Alliance
 
Transforming Utility Networks: Large-scale Data Migrations with FME
Safe Software
 
“NPU IP Hardware Shaped Through Software and Use-case Analysis,” a Presentati...
Edge AI and Vision Alliance
 
MuleSoft MCP Support (Model Context Protocol) and Use Case Demo
shyamraj55
 
The 2025 InfraRed Report - Redpoint Ventures
Razin Mustafiz
 

Ruby for Java Developers

Editor's Notes