59
10 Things You Should Know About Ruby

10 Things you should know about Ruby

  • Upload
    sikachu

  • View
    9.282

  • Download
    4

Embed Size (px)

DESCRIPTION

Interrest in Ruby? I think these are 10 things you should know about it. This slide is released under CC-BY-NC-SA

Citation preview

Page 1: 10 Things you should know about Ruby

10 ThingsYou Should Know About

Ruby

Page 2: 10 Things you should know about Ruby

1. Ruby != Rails

Page 3: 10 Things you should know about Ruby

• Programming Language

• 1995 – First public release

• Many Implementations

• MRI 1.8 – Matz’s Ruby Intepreter

• YARV 1.9

• JRuby

• IronRuby

• Rubinius

• MacRuby

• MagLev

Page 6: 10 Things you should know about Ruby

• Web application framework written in Ruby

• “Ruby” on “Rails”

• David Heinemeier Hansson (DHH)

• Extracted from 37Signal’s Basecamp in 2004

Page 7: 10 Things you should know about Ruby

• Open Source

• Currently maintained by Rails Core Team

• git://github.com/rails/rails

• Latest version: 3.0.1

Page 8: 10 Things you should know about Ruby

No more confusion!

http://www.flickr.com/photos/ecstaticist/2589723846/

Page 9: 10 Things you should know about Ruby

2. Simple syntax

Page 10: 10 Things you should know about Ruby
Page 11: 10 Things you should know about Ruby
Page 12: 10 Things you should know about Ruby
Page 13: 10 Things you should know about Ruby
Page 14: 10 Things you should know about Ruby
Page 15: 10 Things you should know about Ruby
Page 16: 10 Things you should know about Ruby
Page 17: 10 Things you should know about Ruby

Too Easy!

http://www.flickr.com/photos/clairity/143368932/

Page 18: 10 Things you should know about Ruby

3. Pure Object-Oriented

Page 19: 10 Things you should know about Ruby

Everything in Rubyis Object

Page 20: 10 Things you should know about Ruby

No Primitive

Page 21: 10 Things you should know about Ruby
Page 22: 10 Things you should know about Ruby

Even nil ...

Page 23: 10 Things you should know about Ruby
Page 24: 10 Things you should know about Ruby

... and class!

Page 25: 10 Things you should know about Ruby
Page 26: 10 Things you should know about Ruby

http://www.flickr.com/photos/gastev/2630867950/

Related to duck!

Page 27: 10 Things you should know about Ruby

4. No method call

Page 28: 10 Things you should know about Ruby

“Message sending”

Page 29: 10 Things you should know about Ruby
Page 30: 10 Things you should know about Ruby
Page 32: 10 Things you should know about Ruby

5. Mixin

Page 33: 10 Things you should know about Ruby

Module

Page 34: 10 Things you should know about Ruby

Module

• Collection of methods and constants

• Not-instanciatable

• But callable

• Append features upon included

Page 35: 10 Things you should know about Ruby

Multiple inheritanceis very bad

Page 36: 10 Things you should know about Ruby

Mixin

• Include methods you want from another module

• No limit of how many modules you include

Page 37: 10 Things you should know about Ruby
Page 38: 10 Things you should know about Ruby

{ 6. }

(block)

Page 39: 10 Things you should know about Ruby

“Closure”

Page 40: 10 Things you should know about Ruby

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

Page 41: 10 Things you should know about Ruby
Page 42: 10 Things you should know about Ruby

7. We love duck

http://www.flickr.com/photos/ymorimo/3975152607/

Page 43: 10 Things you should know about Ruby

Duck typing

• If it quacks like a duck, it’s a duck!

• Check for object’s property, not interface

Page 44: 10 Things you should know about Ruby
Page 45: 10 Things you should know about Ruby
Page 46: 10 Things you should know about Ruby

Duck Punching!

Page 47: 10 Things you should know about Ruby

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

Page 48: 10 Things you should know about Ruby
Page 49: 10 Things you should know about Ruby

8. Testing isFFFF**...

(FFFFUUNNN)

Page 50: 10 Things you should know about Ruby

Encourage testing

Page 51: 10 Things you should know about Ruby

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

Page 52: 10 Things you should know about Ruby

Testing tools

• RSpec

• Cucumber

• Test::Unit

• Rack::Test

Page 53: 10 Things you should know about Ruby
Page 54: 10 Things you should know about Ruby

9. RubyGems

Page 55: 10 Things you should know about Ruby

Libraries in Ruby

Page 56: 10 Things you should know about Ruby

http://rubygems.org

Page 57: 10 Things you should know about Ruby

Gem

• Library written under Ruby or C

• Packaged by owner and upload to RubyGems.org

• Easy to install, just gem install gem_name

Page 58: 10 Things you should know about Ruby

10. IT’S FUN!

Page 59: 10 Things you should know about Ruby

Question?

Thank you!

Prem Sichanugrist

@sikachu

http://sikachu.com

3.9454 in

Beautiful Software