Upgrade to Pro — share decks privately, control downloads, hide ads and more …

10 Things you should know about Ruby

10 Things you should know about Ruby

Interrest in Ruby? I think these are 10 things you should know about it.

This was presented in Barcamp Bangkok 4, Oct 23-24, 2010, at Sripathum University Bangkhen Campus.

Prem Sichanugrist

October 23, 2010

More Decks by Prem Sichanugrist

Other Decks in Programming


  1. • Programming Language • 1995 – First public release •

    Many Implementations • MRI 1.8 – Matz’s Ruby Intepreter • YARV 1.9 • JRuby • IronRuby • Rubinius • MacRuby • MagLev
  2. “I wanted a scripting language that was more powerful than

    Perl, and more object-oriented than Python. That's why I decided to design my own language”
  3. • Web application framework written in Ruby • “Ruby” on

    “Rails” • David Heinemeier Hansson (DHH) • Extracted from 37Signal’s Basecamp in 2004
  4. • Open Source • Currently maintained by Rails Core Team

    • git://github.com/rails/rails • Latest version: 3.0.1
  5. Module • Collection of methods and constants • Not-instanciatable •

    But callable • Append features upon included
  6. Mixin • Include methods you want from another module •

    No limit of how many modules you include
  7. Ruby’s Block • Passing a block as argument • Method

    “yield” or “call” the block • May passing a object as argument • Result from the block goes back to the method
  8. Duck typing • If it quacks like a duck, it’s

    a duck! • Check for object’s property, not interface
  9. Duck Punching (Monkey patch) • Objects and class are open

    • Add method to object even at Runtime! • Not really recommend, less maintainability, might break some stuff • But it’s awesome
  10. Testing ... • Ensure everything still works after you make

    change to something else • Save you ass from client’s call at 3AM • Test driven development • Write test – watch it fails – write just enough code to make it pass – refactor
  11. Gem • Library written under Ruby or C • Packaged

    by owner and upload to RubyGems.org • Easy to install, just gem install gem_name