1 JRuby Charles Oliver Nutter JRuby Guy Sun Microsystems 1.

Slides:



Advertisements
Similar presentations
More about Ruby Maciej Mensfeld Presented by: Maciej Mensfeld More about Ruby dev.mensfeld.pl github.com/mensfeld.
Advertisements

Chapter 15 © 2010 by Addison Wesley Longman, Inc Origins and Uses of Ruby - Designed by Yukihiro Matsumoto; released in Use spread rapidly.
Creating Web Services with Ruby on Rails Robert Thew Internet and Web Systems II.
Language of the Month If it’s December, it must be Ruby! Adam Coffman and Brent Beer.
Sakai on Rails Integrating Ruby and Sakai David Adams, Virginia Tech.
Ruby on Rails Tutorial Peter Mosca April, Ruby on Rails Tutorial Ruby History Invented 12 years ago in Japan by Yukihiro Matsumoto Spent first 5.
1 JRuby on Rails GAO ANG Sun Functional Campus Ambassador 1.
Ruby The Gem of new programming languages. An interpreted scripting language.
Ruby on Rails Charles Severance Textbook: Build Your own Ruby on Rails Application by Patrick Lenz (ISBN: )
A TOUR OF RUBY 2011 ACM Class, Dong Xie. What is Ruby?  Dynamic programming language  Complex but expressive grammar  A core class library with rich.
Ruby & rails by Nicholas Belotti. What is ruby Ruby is an object orientated scripting language. In Ruby...everything is an object! Ruby was released in.
JRuby: Bringing Ruby to the JVM™ Thomas E. Enebo, Aandtech Inc. Charles Oliver Nutter, Ventera Corp
Web Application Programming Carol Wolf Computer Science.
By: Maksim Surguy & Cesar Acosta require 'sinatra‘ get ‘/' do "Hello World!" end.
Ruby! Ronald L. Ramos. What is Ruby? Ruby is a scripting language designed by Yukihiro Matsumoto, also known as Matz. It runs on a variety of platforms,
USING RUBY An Introduction By Evgeny Rahman. About Me Principal Engineer at FirstFuel Software 10+ years in Software Engineering 5 years working with.
Ruby/Ruby on Rails Yasushi Osonoi Open Dream corporation
© FPT SOFTWARE – TRAINING MATERIAL – Internal use 04e-BM/NS/HDCV/FSOFT v2/3 JSP Application Models.
© 2012 LogiGear Corporation. All Rights Reserved FitNesseFitNesse Authors: Nghia Pham 1.
Ruby on Rails. Web Framework for Ruby Designed to make it easier to develop, deploy, and maintain web applications Design with Model-View-Controller –almost.
Presented By P.SRIVIDYA 085D1A0552 Programming Language.
Visual Mobile Applications with Netbeans 6.0 Your Name Sun Campus Ambassador Your Address.
Web Services with Netbeans 6.0 Your Name Sun Campus Ambassador Your Address.
Web Application Development with PHP in Netbeans 6.5 ● Angad Singh Campus Ambassador Tech Lead
1 JRuby Now and Future Charles Oliver Nutter JRuby Guy Sun Microsystems Except where otherwise noted, the content of this presentation is licensed under.
Visual Mobile Gaming Your Name Sun Campus Ambassador Your Address.
1 JRuby: Up and Running! Charles Oliver Nutter and Thomas Enebo The JRuby Guys Sun Microsystems Except where otherwise noted, the content of this presentation.
NetBeans & Ruby David Botterill Software Engineer Global Technology Manager - Campus Ambassador Program Sun Microsystems, Inc.
JRuby: Ruby and Rails for the JVM Charles Nutter Except where otherwise noted, the content of this presentation is licensed under the Creative Commons.
CodeBeamer Bootcamp 2007 Customizing CodeBeamer features through scripting Aron Gombas Architect, Intland.
1 NetBeans New and Cool Sun Microsystems, Inc.. 2 Goal of the Talk Learn how NetBeans IDE can help you become more productive Learn about the new features.
GlassFish Workshop 1 Dynamic Languages in GlassFish Arun Gupta blogs.sun.com/arungupta.
1 Charles Oliver Nutter Thomas Enebo Tor Norbye Martin Krauskopf JRuby: Understanding the Fuss Except where otherwise noted, the content of this presentation.
Netbeans: Beyond Java Silveira Neto Sun Campus Ambassador University of Ceará, Brazil.
JRuby on Rails Presenter Name
JRuby on Rails Brian Leonard ブライアン レオナルド
Visual Web & AJAX with Netbeans 6.0 Your Name Sun Campus Ambassador Your Address.
1 Sun Microsystems, Ruby, and JRuby Charles Oliver Nutter Senior Staff Engineer Sun Microsystems Except where otherwise noted, the content of this presentation.
Web Database Programming Using PHP
Top 8 Best Programming Languages To Learn
JRuby: Ready for ACTION!
Ruby: An Introduction Created by Yukihiro Matsumoto in 1993 (named after his birthstone) Pure OO language (even the number 1 is an instance of a class)
Scope History of Ruby. Where can you use Ruby? General Features.
JRuby: Up and Running! Charles Oliver Nutter and Thomas Enebo
Chapter 1 Introduction to Computers, Programs, and Java
Web Database Programming Using PHP
Ruby Tooling in NetBeans
Netbeans 6.0 Your Name Sun Campus Ambassador Your Address.
Platform as a Service.

JRuby Charles Oliver Nutter
JRuby on Rails Charles Oliver Nutter JRuby Core Developer
The plan What's JRuby? The Ruby language Why JRuby? How to use it
PHP Training at GoLogica in Bangalore
Longtime Java developer More recent Ruby developer
The Improvement of PaaS Platform ZENG Shu-Qing, Xu Jie-Bin 2010 First International Conference on Networking and Distributed Computing SQUARE.
JRuby It's What's For Dinner
JRuby: Up and Running! Charles Oliver Nutter and Thomas Enebo
Ruby, Rails, GUIs, and More
PHP / MySQL Introduction
JRuby State of the Art! Except where otherwise noted, the content of this presentation is licensed under the Creative Commons Attribution-Share Alike 3.0.
JRuby Charles Oliver Nutter JRuby Guy Sun Microsystems
JRuby: Up and Running! Charles Oliver Nutter and Thomas Enebo
Scripting Java with JRuby
SVTRAININGS. SVTRAININGS Python Overview  Python is a high-level, interpreted, interactive and object-oriented scripting language. Python is designed.
JRuby: Bringing Ruby to the JVM™
Introduction to Python
Creating Lightning Fast Apps Using AngularJS
Chapter 7 –Implementation Issues
Web Application Development Using PHP
Presentation transcript:

1 JRuby Charles Oliver Nutter JRuby Guy Sun Microsystems 1

2 Agenda Ruby and JRuby overview > Facts and figures > Short Ruby tutorial Real-world JRuby > Graphics and games > Web applications > GUI programming Interactive: what do you want to know?

3 The JRuby Guys Charles Oliver Nutter and Thomas Enebo Longtime Java developers (10+ yrs each) Engineers at Sun Microsystems for 2 years Full-time JRuby developers Also working on JVM dynlang support Wide range of past experience > C, C++, C#, Perl, Python, Delphi, Lisp, Scheme > Java EE and ME, JINI, WS

4 What Is Ruby Dynamic-typed, pure OO language > Interpreted > Open source, written in C > Good: easy to write, easy to read, powerful, “fun” > Bad: green threads, unicode support, libraries, “slow” Created 1993 by Yukihiro “Matz” Matsumoto > “More powerful than Perl and more OO than Python” Very active community, wide range of apps Ruby 1.8.x is current, 1.9 is in development

5 Ruby Growth (Gartner Projection)

6 Ruby Conferences in 2008 RubyConf, RailsConf, RailsConf EU, acts_as_conference, Euruko, Ruby Kaigi, Mountain West RubyConf, eRubyCon, Ruby Hoedown, Amsterdam Ruby en Rails, Scotland on Rails, RubyFools Copenhagen, RubyFools Oslo, Voices that Matter, South Carolina Ruby Conference, Lone Star RubyConf, RuPy, Gotham Ruby Conference, Silicon Valley Ruby Conference, RubyCamp, Conferencia Rails, Rails Summit Latin America, Ruby Manor, Atlanta Merb Day,...

7 Ruby Books in 2008 NetBeans™ Ruby and Rails IDE with JRuby, Learning Rails, Rails for.NET Developers, Wicked Cool Ruby Scripts, JRuby Cookbook, Enterprise Recipes with Ruby and Rails, Developing Facebook Platform Applications with Rails, Foundation Rails 2, Enterprise Rails, Ruby On Rails Bible, Rails: Up and Running, Rails Pocket Reference, Ruby Phrasebook, Scripted GUI Testing with Ruby, Aptana RadRails, Advanced Rails Recipes, Deploying Rails Applications, The Art of Rails, Simply Rails 2, Practical REST on Rails 2 Projects, Ruby on Rails Web Mashup Projects, FXRuby: Create Lean and Mean GUIs with Ruby, RailsSpace, Ferret, Professional Ruby on Rails, Ruby: The Programming Language, Rails for PHP Developers, Pulling Strings with Puppet, Practical Reporting with Ruby and Rails, The Ruby Programming Language, Design Patterns in Ruby, Advanced Rails

8 JRuby Java implementation of Ruby language > “It's just Ruby!” Started in 2002, open source, many contributors > Ola Bini, Marcin Mielzynsky, Nick Sieger, Vladimir Sizikov, MenTaLguY, Wayne Meissner Aiming for compatibility with current Ruby version > Ruby Improvements on Ruby > Native threading, better performance, many libraries

9 Ruby Quick Tour: Pure OO Everything is an Object > Circle.new(4)=> instance of Circle > “abc”.length => 3 > 1.to_s => “1” All Objects are instances of Classes > 1.class=> Fixnum Single-Inheritance Object is base class of all classes

10 Ruby Quick Tour: Basics Literals > Fixnum: 1 > Float: 1.0 > Bignum: > String: “one” 'one' %Q[one] %q[one]... > Multiline string (“here doc”): x = <<EOS extend across two lines EOS > Symbol: :one, %s[one] > Regexp: /^foo\w+.*bar$/, %r[^foo$] > Array: [1, “ein”, :ichi] > Hash: {:one => 1, :two => 2}

11 Ruby Quick Tour: Basics String interpolation > a = “foo” > b = “bar#{a}baz” => “barfoobaz” Operator overloading > def +(arg);... Attributes > class Foo attr_accessor :a end x = Foo.new x.a = “hello” puts x.a => “hello”

12 Ruby Quick Tour: Duck Typing Dynamic typing “If it waddles like a duck and it quacks like a duck...” Runtime errors rarely happen > Unit testing helps prevent them def make_it_waddle(waddler) waddler.waddle end make_it_waddle(Duck.new) make_it_waddle(Penguin.new) make_it_waddle(Octopus.new)

13 Ruby Quick Tour: A Simple Class class Hello # initialize is Ruby's constructor def = message end def print # insert into a string puts "Hello end # construct a Hello object hello = Hello.new("Devoxx!") hello.print

14 Ruby Quick Tour: Blocks/Closures # two formats: braces {} and do.. end [1, 2, 3].each {|number| puts “I see #{number}“ } [1, 2, 3].each do |number| puts “I see #{number}“ end # methods that accept blocks def foo yield “hello“ end def foo2(&block) block.call(“hello“) end

15 Ruby Quick Tour: Modules # A collection of objects class MyProducts # Enumerable provides iteration methods include Enumerable # define an 'each' method that iterates def each # yield each element in turn end list = MyProducts.new list.select {|item| item.price > 5.00} list.sort {|a, b| a.name b.name} list.max

16 Ruby Quick Tour: RubyGems Ruby's packaging system > Think CPAN, Maven, apt, rpm Shipped with JRuby > Step 1: unpack JRuby > Step 2 (optional): add 'bin' to PATH > Step 3: bin/gem install > You're ready to go! All major Ruby projects are in gems > Look for 'gem install....' in upcoming slides

17 Where is JRuby being used? Graphics and Games > Ruby + graphics = cool JRuby on Rails > Better deployment options, better performance GUI development > Makes Swing much nicer to use, easier to handle

18 Ruby-Processing “Processing is an open source programming language and environment for people who want to program images, animation, and interactions.” > Basically a cool Java library for 2D graphics Ruby-Processing wraps Processing with JRuby > Cool, rubified 2D graphics environment for you > Eye-candy demos for us > Thanks to Jeremy Ashkenas for putting these together

19 JMonkeyEngine JMonkeyEngine: 3D Scenegraph library > OpenGL, Used Commercially

20 DEMO Pretty Graphics! 20

21 Web Applications: Ruby on Rails A Full-stack MVC web development framework Open Source (MIT), Many Contributors Written entirely in Ruby First released in 2004 Growing popularity > RailsConf attendance: 500, 1000, 2500 since 2006 > Four Rails books downstairs (and more Ruby books) > Hundreds of job postings and growing fast

22 Rails Precepts Convention over Configuration > Why punish the common cases? > Encourages standard practices > Everything simpler and smaller Don't Repeat Yourself (DRY) > Framework written around minimizing repetition > Repetitive code harmful to adaptability Agile Development Environment > No recompile, deploy, restart cycles > Simple tools to generate code quickly > Testing built into framework

23 The Rails Way: Controllers # app/controllers/person_controller.rb class PersonController < ApplicationController verify :method => :post, :only => [:create, :update, :delete] def = Person.find :all end alias :index :list def = redirect_to :action => 'list' end...

24 The Rails Way: Views 'show', :id => person %> 'edit', :id => person %> 'destroy', :id => person }, :confirm => 'Are you sure?', :method => :post } } %>

25 The Rails Way: Persistence # connect to the database ActiveRecord::Base.establish_connection( :adapter => "mysql", :database => "mydb", :host => "localhost", :username => "mydb_user", :password => "foo" ) # create a model object class Contact < ActiveRecord::Base end # persist! Contact.create "name" => "Charles Nutter", "title" => "JRuby Developer" Contact.create "name" => "Thomas Enebo", "title" => "JRuby Developer" # query Contact.find(:all).each {|c| puts c.name} nutter = Contact.find_by_name("Charles Nutter") # update nutter.title = "Dark Overlord of the Universe" nutter.save

26 Rails Walkthrough 26

27 Production JRuby on Rails Sun's Kenai.com – project hosting site > Oracle's Mix – digg-like social customer site > mix.oracle.com ThoughtWorks' Mingle – collaborative project mgmt > mingle.thoughtworks.com Trisano – infectious disease tracking for US gov'ts > Many others in government, large biz, telecom

28 GUI Programming Swing API is very large, complex > Ruby magic simplifies most of the tricky bits Java is a very verbose language > Ruby makes Swing actually fun No consistent cross-platform GUI library for Ruby > Swing works everywhere Java does (everywhere) No fire-and-forget execution > No dependencies: any script works on any JRuby install

29 GUI Library Options Rubeus – gem install rubeus > Builder-like DSL syntax Profligacy – gem install profligacy > Rubified layout expression language > Trivial event binding without listeners MonkeyBars – gem install monkeybars > Leverage GUI builders > MVC structure...and 5+ others for Swing, SWT, and Qt

30 DEMO Swing in Ruby 30

31 Thank you! JRuby - > wiki.jruby.org GlassFish - glassfish.dev.java.net > gem install glassfish > Looking for bug reports, feature requests! Charlie's blog: blog.headius.com Tom's blg: