JRuby - Programmer's Best Friend on JVM

  • 1,109 views
Uploaded on

Presentation at Java Day Riga 2012 conference

Presentation at Java Day Riga 2012 conference

More in: Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
No Downloads

Views

Total Views
1,109
On Slideshare
0
From Embeds
0
Number of Embeds
1

Actions

Shares
Downloads
11
Comments
1
Likes
3

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. Programmer’s Best Friend on JVM Raimonds Simanovskis
  • 2. @rsim github.com/rsimRaimonds Simanovskis
  • 3. The easiest Business Intelligence tool on the Web
  • 4. What isRuby?
  • 5. object-oriented dynamic programming language simple from outside YukihiroMatsumotoor “Matz” powerful inside
  • 6. Classes
  • 7. Single Inheritance
  • 8. Constructor
  • 9. No Type Declarations
  • 10. Instance Variables
  • 11. Last expression isalways return value
  • 12. .new is just a class method
  • 13. Blocks / ClosuresAnonymous function as argument
  • 14. Modules
  • 15. Metaprogramming
  • 16. Classes/Modules are open
  • 17. Integration with Java Embed JRuby as scripting engine Use Java classes from JRuby
  • 18. Embed JRuby
  • 19. Embed JRuby
  • 20. Use Java classes from JRuby Demo
  • 21. Build with Rake
  • 22. Test with Test::Unit or RSpec
  • 23. Test with Test::Unit or RSpec
  • 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. MVC Architecture Request Router Database SQLBrowser Response Action Active Controller RecordAction View
  • 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. 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. 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. JRuby deployment <insert app server here> Java app sever Application WAR fileApplication JRuby Gems warbler source Application
  • 30. JRuby deployment Web Server Trinidad JRuby Apache Tomcat GemsApplication deploy Application source
  • 31. JRuby deployment
  • 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. JRuby 1.7 and Java 7 invokedynamic
  • 34. Ruby method calls
  • 35. Ruby method calls
  • 36. Ruby method calls
  • 37. Ruby method calls
  • 38. Ruby method calls
  • 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. JRuby BenefitsEasy to learn for Java programmers Easy to mix Ruby and Java Useful frameworks and librariesHigher productivity for many tasks Ruby community