JRuby on Rails - PowerPoint PPT Presentation

About This Presentation
Title:

JRuby on Rails

Description:

JRuby on Rails. GAO ANG. Sun Functional Campus Ambassador. http://www.gaoang.com ... Open Source interpreted scripting language, like Perl, Python, Tcl, etc. ... – PowerPoint PPT presentation

Number of Views:178
Avg rating:3.0/5.0
Slides: 23
Provided by: kimm161
Category:

less

Transcript and Presenter's Notes

Title: JRuby on Rails


1
JRuby on Rails
  • GAO ANG
  • Sun Functional Campus Ambassador
  • http//www.gaoang.com
  • tomgaoang_at_gmail.com

1
2
Agenda
Introduction to Ruby
What is JRuby
JRuby on Rails
JRuby on Netbeans
Where To Go
3
What is Ruby?
  • Created/lead by Matz
  • Open Source interpreted scripting language, like
    Perl, Python, Tcl, etc.
  • Focused on being very object oriented,
    expressive, and bringing joy to programming.

4
Ruby calling Java
  • require javainclude_class javax.swing.JFrame
    include_class javax.swing.JButtonfrm
    JFrame.new(My frame)btn JButton.new(My
    button)frm.set_size(300, 300)frm.content_pane.
    add(btn)frm.show

5
Interactive ruby console irbirb
  • This powerful tool can be used for trying out
    single line commands while you are getting used
    to Ruby, or to run whole programs.

6
Ruby in a nutshell RubyGems
  • Ruby Gem http//docs.rubygems.org/
  • Examples
  • gem list
  • gem install redcloth --version "gt 3.0.0"
  • Using gems in your program
  • require rubygems
  • require some_gem

7
What is Ruby on Rails
  • Web Framework that makes MVC-oriented web apps
    easy through a template engine, ORM
    (ActiveRecord) ,test driven development.
  • Much less complicated than J2EE solutions, but
    perhaps more so than PHP or Perl in cgi-bin.
  • Similar Web Framework
  • Python (TurboGears, Django)
  • Perl (Maypole)
  • Groovy on Rails (Grails)
  • Ruby(Merb)

8
Java and Rails
9
Rails Architecture
  • Rails applications are implemented using the
    Model-View-Controller (MVC)
  • Model - ActiveRecord
  • View - ActionView
  • Controller - ActionController

10
Comparison of Rails and J2EE stacks
  • Tomcat servlet container
  • Struts Web application framework
  • Hibernate persistence framework

11
Database Migration (Bookmarks)
  • db/migrate/001_create_bookmarks.rb
  • class CreateBookmarks lt ActiveRecordMigration
  • def self.up
  • create_table bookmarks do t
  • t.column url, string
  • t.column title, string
  • end
  • end
  • def self.down
  • drop_table bookmarks
  • end
  • end

12
Running the Migration
  • Rake is the general purpose build tool for rails,
    much like make, or ant. It has many functions,
    one of which is to control migrations.
  • rake dbmigrate
  • Now the table has been created
  • Migration in Netbeans

13
What is JRuby
http//jruby.codehaus.org/
  • 100 Java impl of Ruby
  • Ruby on the JVM
  • Pure interpreted, native threaded
  • Born 2001, product of many developers
  • Largely Ruby 1.8-compatible
  • Slower than Ruby...for now

14
Why JRuby on Rails
  • Java is pervasive
  • Java libraries are exhaustive
  • Many still believe Java is the everytool
  • Java webapp developers are unhappy
  • Rails webapp developers are happy

15
Advantage of JRuby on Rails
  • JRuby on Rails mostly works right now
  • JRuby will not be done until its fully working
  • ActiveRecord-JDBC opens many doors
  • Java EE is actually fun with Rails
  • More Rails is more Rails...JRuby enables!

16
JRuby on Netbeans
17
Netbeans 6.1 Depot Demo
18
Where to go for Ruby information
  • Online material
  • http//www.ruby-doc.org/
  • http//rubyonrails.org/
  • Rails screencast(s)
  • Planet Ruby on Rails

19
Netbeans 6 Resources
  • Netbeans Product Site http//www.netbeans.org
  • Download previews, current past releases of
    IDE, plugins
  • Learning tutorials, technical articles, flash
    demos
  • Community latest news, forums, events, mailing
    lists
  • Netbeans Wiki http//wiki.netbeans.org/wiki/
  • Open-source documentation site for Netbeans.
  • Planet Netbeans http//www.planetnetbeans.org/
  • Aggregate for all Netbeans-related blogs
  • Netbeans TV http//www.netbeans.tv/
  • Connecting the diverse and worldwide community of
    People, Projects and Technologies surrounding
    NetBeans.

20
Stay In Touch
  • Check blog regularly
  • http//blogs.sun.com/
  • http//www.javapassion.com/
  • http//blogs.sun.com/GaoAng/
  • Join Java Open Source User Group
  • BJUG http//www.bjug.org/
  • BLUG http//www.beijinglug.org/
  • You Can find lots of material on
  • http//developers.sun.com/students/

21
Resources
  • http//java.sun.com/
  • Java 2 Platform, Standard Edition v1.4.1
  • java, javac, jar, jre, etc.
  • Online documentation and tutorials
  • http//www.netbeans.org/
  • Docs Support
  • Netbeans Tutorials Training
  • Get the latest version of Netbeans
  • http//developers.sun.com.cn/
  • The Source for Sun Developer Solutions
  • http//www.sunacademic.com

22
THANK YOU
  • Gao Ang
  • Sun Functional Campus Ambassador
  • http//www.gaoang.com
  • tomgaoang_at_gmail.com

30
Write a Comment
User Comments (0)
About PowerShow.com