Reasons To Love Ruby
Upcoming SlideShare
Loading in...5
×
 

Reasons To Love Ruby

on

  • 2,034 views

A general introduction to the Ruby language and ecosystem from a .NET Developer's perspective.

A general introduction to the Ruby language and ecosystem from a .NET Developer's perspective.

Statistics

Views

Total Views
2,034
Views on SlideShare
1,943
Embed Views
91

Actions

Likes
0
Downloads
14
Comments
0

5 Embeds 91

http://flux88.com 50
http://benscheirman.com 36
http://www.slideshare.net 3
http://rssbandit.org 1
http://translate.googleusercontent.com 1

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Reasons To Love Ruby Reasons To Love Ruby Presentation Transcript

  • 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 Ruby
    puts“hello world”hello world
    puts“hello world”.reversedlrowolleh
    puts“hello world”[0..5] hello
  • Ruby Variables
    num = 323
    message = “Hey there”
    stuff = [1, “foo”, true]
  • Ruby Loops
    [“cat”, “dog”, “giraffe”].each do |s|
    puts s
    end
    [“cat”, “dog”, “giraffe”].each { |s| puts s }
  • Working with Arrays
    animals = [“zebra”, “donkey”, “lemur”]
    animals.sort[“donkey”, “lemur”, “zebra”]
    # original array is untouched
    animals.sort!
    # original array is modified!
    animals.delete“zebra” [“donkey”, “lemur”]
  • Ruby has Less Ceremony
    //C#
    Dictionary<string, object> hash = new Dictionary<string, object>();
    #ruby
    hash = {}
    #optional semicolons & parentheses
    add(5, 6); is the same as add 5, 6
  • You Can Extend Existing classes
    5.days.from_now
  • Ruby is Terse, yet Readable
    3.times { print “Ho ” } => Ho Ho Ho
    approve_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 Object
    42.class FixNum
    42.2.class.superclass  Integer
    42.class.superclass.superclass  Numeric
    42.class.superclass.superclass.superclass  Object
    No, really… everything is an object
    puts customer.name unless customer.nil?
    nil.classNilClass
    nil.class.superclass Object
  • RubyGems
    gem 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
  • Rake
    task :codeGen do
    # do the code generation
    end
    task :compile => :codeGen do
    #do the compilation
    end
    task :dataLoad => :codeGen do
    # load the test data
    end
    task :test => [:compile, :dataLoad] do
    # run the tests
    end
  • RSpec
    # bowling_spec.rb
    require 'bowling'
    describe Bowling do
    it "should score 0 for gutter game" do
    bowling = Bowling.new
    20.times { bowling.hit 0 }
    bowling.score.should == 0
    end
    end
  • …and now the elephant in the room
    rails
  • Rails is the bee’s knees because…
    convention
    configuration
  • Rails is the bee’s knees because…
    it has
    ActiveRecord
  • Rails is the bee’s knees because…
    it has
    Migrations
  • Rails is the bee’s knees because…
    it has the
    Console
  • 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