Programmer’s Best  Friend on JVM    Raimonds Simanovskis
@rsim                          github.com/rsimRaimonds Simanovskis
The easiest Business Intelligence tool on the Web
What isRuby?
object-oriented                  dynamic            programming language             simple from outside YukihiroMatsumoto...
Classes
Single Inheritance
Constructor
No Type Declarations
Instance Variables
Last expression isalways return value
.new is just a class method
Blocks / ClosuresAnonymous function as argument
Modules
Metaprogramming
Classes/Modules are open
Integration with Java      Embed JRuby as      scripting engine      Use Java classes        from JRuby
Embed JRuby
Embed JRuby
Use Java classes  from JRuby     Demo
Build with Rake
Test with Test::Unit or RSpec
Test with Test::Unit or RSpec
Ruby on RailsWeb applications development frameworkModel View Controller (MVC) architecture     Convention over Configurati...
MVC Architecture              Request    Router      Database                                      SQLBrowser  Response   ...
ActiveRecord (Model)class CreatePosts < ActiveRecor::Migration  def self.up    create_table :posts do |t|   CREATE TABLE p...
ActionControllerclass PostsController < ApplicationController  # GET /posts  def index    @posts = Post.all  end # GET /po...
ActionView<h1>Posts</h1><% @posts.each do |post| %>  <h2><%= post.title %></h2>  <h3>Created at <%= post.created_at %></h3...
JRuby deployment   <insert app server here>                          Java app sever                        Application WAR...
JRuby deployment                         Web Server                       Trinidad         JRuby                        Ap...
JRuby deployment
eazyBI case study                                                           .com Ruby on Rails                            ...
JRuby 1.7 and Java 7    invokedynamic
Ruby method calls
Ruby method calls
Ruby method calls
Ruby method calls
Ruby method calls
JRuby performance          improvements                       JRuby/Java 6                      JRuby/Java 7              ...
JRuby BenefitsEasy to learn for Java programmers   Easy to mix Ruby and Java Useful frameworks and librariesHigher producti...
JRuby - Programmer's Best Friend on JVM
Upcoming SlideShare
Loading in...5
×

JRuby - Programmer's Best Friend on JVM

1,276

Published on

Presentation at Java Day Riga 2012 conference

Published in: Technology
1 Comment
3 Likes
Statistics
Notes
No Downloads
Views
Total Views
1,276
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
14
Comments
1
Likes
3
Embeds 0
No embeds

No notes for slide

JRuby - Programmer's Best Friend on JVM

  1. 1. Programmer’s Best Friend on JVM Raimonds Simanovskis
  2. 2. @rsim github.com/rsimRaimonds Simanovskis
  3. 3. The easiest Business Intelligence tool on the Web
  4. 4. What isRuby?
  5. 5. object-oriented dynamic programming language simple from outside YukihiroMatsumotoor “Matz” powerful inside
  6. 6. Classes
  7. 7. Single Inheritance
  8. 8. Constructor
  9. 9. No Type Declarations
  10. 10. Instance Variables
  11. 11. Last expression isalways return value
  12. 12. .new is just a class method
  13. 13. Blocks / ClosuresAnonymous function as argument
  14. 14. Modules
  15. 15. Metaprogramming
  16. 16. Classes/Modules are open
  17. 17. Integration with Java Embed JRuby as scripting engine Use Java classes from JRuby
  18. 18. Embed JRuby
  19. 19. Embed JRuby
  20. 20. Use Java classes from JRuby Demo
  21. 21. Build with Rake
  22. 22. Test with Test::Unit or RSpec
  23. 23. Test with Test::Unit or RSpec
  24. 24. Ruby on RailsWeb applications development frameworkModel View Controller (MVC) architecture Convention over Configuration Don’t Repeat Yourself (DRY) Focused on developer productivity Agile software development approach
  25. 25. MVC Architecture Request Router Database SQLBrowser Response Action Active Controller RecordAction View
  26. 26. ActiveRecord (Model)class CreatePosts < ActiveRecor::Migration def self.up create_table :posts do |t| CREATE TABLE posts ( t.string :title id NUMBER(38) NOT t.text :body NULL, t.timestamps title VARCHAR2(255), end body CLOB, end created_at DATE,end updated_at DATE ); CREATE SEQUENCE posts_seq;class Post < ActiveRecord::Base # nothing here!endpost = Post.newpost.title = "First post"post.savepost = Post.find(1)puts post.name # output: "First post"
  27. 27. ActionControllerclass PostsController < ApplicationController # GET /posts def index @posts = Post.all end # GET /posts/1 def show @post = Post.find(params[:id]) end # GET /posts/new def new @post = Post.new end # ...end
  28. 28. ActionView<h1>Posts</h1><% @posts.each do |post| %> <h2><%= post.title %></h2> <h3>Created at <%= post.created_at %></h3> <p><%= post.body %></p><% end %>
  29. 29. JRuby deployment <insert app server here> Java app sever Application WAR fileApplication JRuby Gems warbler source Application
  30. 30. JRuby deployment Web Server Trinidad JRuby Apache Tomcat GemsApplication deploy Application source
  31. 31. JRuby deployment
  32. 32. eazyBI case study .com Ruby on Rails Jetty JRuby application deploy Application GemsMondrian OLAP engineApache Batik SVG toolkit pac Private kag e package Packaged application pluginOSGi bundle Application GemsJRuby jruby-rack *.jar Application Gems SQL Server
  33. 33. JRuby 1.7 and Java 7 invokedynamic
  34. 34. Ruby method calls
  35. 35. Ruby method calls
  36. 36. Ruby method calls
  37. 37. Ruby method calls
  38. 38. Ruby method calls
  39. 39. JRuby performance improvements JRuby/Java 6 JRuby/Java 7 Times Faster than Ruby 1.9.3 5 4.226 4.323.75 3.66 3.44 2.5 2.658 1.914 1.806 1.538 1.5651.25 1.346 0 base64 richards neural mandelbrot redblack
  40. 40. JRuby BenefitsEasy to learn for Java programmers Easy to mix Ruby and Java Useful frameworks and librariesHigher productivity for many tasks Ruby community
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×