a bunch of reasons to love ruby
class Ben < Personis_a :mvp, :scrummaster, :aspinsider  def initialize		@book = “ASP.NET MVC in Action”	@twitter = “subdigital”	@blog= “http://flux88.com”	@iphone_app= “Pocket Tabs”  end  ...end
def self.expert?	falseend
Meet Rubyputs“hello world”hello worldputs“hello world”.reversedlrowollehputs“hello world”[0..5] hello
Ruby Variablesnum = 323message = “Hey there”stuff = [1, “foo”, true]
Ruby Loops[“cat”, “dog”, “giraffe”].each do |s|	puts send[“cat”, “dog”, “giraffe”].each { |s| puts s }
Working with Arraysanimals = [“zebra”, “donkey”, “lemur”]animals.sort[“donkey”, “lemur”, “zebra”]			 # original array is untouchedanimals.sort!# original array is modified!animals.delete“zebra”  [“donkey”, “lemur”]
Ruby has Less Ceremony//C#Dictionary<string, object> hash = new 							Dictionary<string, object>();#rubyhash = {}#optional semicolons & parenthesesadd(5, 6);     is the same as      add 5, 6
You Can Extend Existing classes5.days.from_now
Ruby is Terse, yet Readable3.times { print “Ho ” }  =>  Ho Ho Hoapprove_credit unless account.deliquent?send_email if email_enabled?
Regex is a 1st class citizen[“red”, “blue”, “green”].grep /u/ blue“The Times They are a-Changin’”.gsub /\s/, “.”The.Times.They.are.a-Changin’
Everything is an Object42.class  FixNum42.2.class.superclass  Integer42.class.superclass.superclass   Numeric42.class.superclass.superclass.superclass    ObjectNo, really… everything is an objectputs customer.name unless customer.nil?nil.classNilClassnil.class.superclass Object
RubyGemsgem installhpricot
Speaking of hpricot…require ‘rubygems’require ‘hpricot’require ‘open-uri’uri = open(“http://whatsit.org”)doc = Hpricot(uri)(doc/"p/a/img").each do |img|   puts img.attributes['class']end
Raketask :codeGen do  # do the code generationendtask :compile => :codeGen do  #do the compilationendtask :dataLoad => :codeGen do  # load the test dataendtask :test => [:compile, :dataLoad] do  # run the testsend
RSpec# bowling_spec.rbrequire 'bowling'describe Bowling do  it "should score 0 for gutter game" do    bowling = Bowling.new    20.times { bowling.hit 0 }bowling.score.should == 0  endend
…and now the elephant in the roomrails
Rails is the bee’s knees because…convention configuration
Rails is the bee’s knees because…it hasActiveRecord
Rails is the bee’s knees because…it hasMigrations
Rails is the bee’s knees because…it has theConsole
Rails is the bee’s knees because…scaffolding
Rails is the bee’s knees because…Logging is built-in
Rails is the bee’s knees because…Tests come out of the box
Rails is the bee’s knees because…There is ONE WAY
What else?heroku
What else?IronRuby
thank_you

Reasons To Love Ruby

  • 1.
    a bunch ofreasons to love ruby
  • 2.
    class Ben <Personis_a :mvp, :scrummaster, :aspinsider def initialize @book = “ASP.NET MVC in Action” @twitter = “subdigital” @blog= “http://flux88.com” @iphone_app= “Pocket Tabs” end ...end
  • 3.
  • 4.
    Meet Rubyputs“hello world”helloworldputs“hello world”.reversedlrowollehputs“hello world”[0..5] hello
  • 5.
    Ruby Variablesnum =323message = “Hey there”stuff = [1, “foo”, true]
  • 6.
    Ruby Loops[“cat”, “dog”,“giraffe”].each do |s| puts send[“cat”, “dog”, “giraffe”].each { |s| puts s }
  • 7.
    Working with Arraysanimals= [“zebra”, “donkey”, “lemur”]animals.sort[“donkey”, “lemur”, “zebra”] # original array is untouchedanimals.sort!# original array is modified!animals.delete“zebra” [“donkey”, “lemur”]
  • 8.
    Ruby has LessCeremony//C#Dictionary<string, object> hash = new Dictionary<string, object>();#rubyhash = {}#optional semicolons & parenthesesadd(5, 6); is the same as add 5, 6
  • 9.
    You Can ExtendExisting classes5.days.from_now
  • 10.
    Ruby is Terse,yet Readable3.times { print “Ho ” } => Ho Ho Hoapprove_credit unless account.deliquent?send_email if email_enabled?
  • 11.
    Regex is a1st class citizen[“red”, “blue”, “green”].grep /u/ blue“The Times They are a-Changin’”.gsub /\s/, “.”The.Times.They.are.a-Changin’
  • 12.
    Everything is anObject42.class FixNum42.2.class.superclass  Integer42.class.superclass.superclass  Numeric42.class.superclass.superclass.superclass  ObjectNo, really… everything is an objectputs customer.name unless customer.nil?nil.classNilClassnil.class.superclass Object
  • 13.
  • 14.
    Speaking of hpricot…require‘rubygems’require ‘hpricot’require ‘open-uri’uri = open(“http://whatsit.org”)doc = Hpricot(uri)(doc/"p/a/img").each do |img| puts img.attributes['class']end
  • 15.
    Raketask :codeGen do # do the code generationendtask :compile => :codeGen do #do the compilationendtask :dataLoad => :codeGen do # load the test dataendtask :test => [:compile, :dataLoad] do # run the testsend
  • 16.
    RSpec# bowling_spec.rbrequire 'bowling'describeBowling do it "should score 0 for gutter game" do bowling = Bowling.new 20.times { bowling.hit 0 }bowling.score.should == 0 endend
  • 17.
    …and now theelephant in the roomrails
  • 18.
    Rails is thebee’s knees because…convention configuration
  • 19.
    Rails is thebee’s knees because…it hasActiveRecord
  • 20.
    Rails is thebee’s knees because…it hasMigrations
  • 21.
    Rails is thebee’s knees because…it has theConsole
  • 22.
    Rails is thebee’s knees because…scaffolding
  • 23.
    Rails is thebee’s knees because…Logging is built-in
  • 24.
    Rails is thebee’s knees because…Tests come out of the box
  • 25.
    Rails is thebee’s knees because…There is ONE WAY
  • 26.
  • 27.
  • 28.