10 Things you should know about Ruby

10,110 views
9,863 views

Published on

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

This slide is released under CC-BY-NC-SA

Published in: Technology
0 Comments
11 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
10,110
On SlideShare
0
From Embeds
0
Number of Embeds
6,234
Actions
Shares
0
Downloads
57
Comments
0
Likes
11
Embeds 0
No embeds

No notes for slide

10 Things you should know about Ruby

  1. 1. 10 Things You Should Know About Ruby
  2. 2. 1. Ruby != Rails
  3. 3. • Programming Language • 1995 – First public release • Many Implementations • MRI 1.8 – Matz’s Ruby Intepreter • YARV 1.9 • JRuby • IronRuby • Rubinius • MacRuby • MagLev
  4. 4. “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”
  5. 5. Smalltalk Perl Lisp Scheme Python CLU Eiffel Ada Dylan {
  6. 6. • Web application framework written in Ruby • “Ruby” on “Rails” • David Heinemeier Hansson (DHH) • Extracted from 37Signal’s Basecamp in 2004
  7. 7. • Open Source • Currently maintained by Rails Core Team • git://github.com/rails/rails • Latest version: 3.0.1
  8. 8. No more confusion! http://www.flickr.com/photos/ecstaticist/2589723846/
  9. 9. 2. Simple syntax
  10. 10. Too Easy! http://www.flickr.com/photos/clairity/143368932/
  11. 11. 3. Pure Object-Oriented
  12. 12. Everything in Ruby is Object
  13. 13. No Primitive
  14. 14. Even nil ...
  15. 15. ... and class!
  16. 16. http://www.flickr.com/photos/gastev/2630867950/ Related to duck!
  17. 17. 4. No method call
  18. 18. “Message sending”
  19. 19. http://www.flickr.com/photos/headlouse/1484615917/
  20. 20. 5. Mixin
  21. 21. Module
  22. 22. Module • Collection of methods and constants • Not-instanciatable • But callable • Append features upon included
  23. 23. Multiple inheritance is very bad
  24. 24. Mixin • Include methods you want from another module • No limit of how many modules you include
  25. 25. { 6. } (block)
  26. 26. “Closure”
  27. 27. 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
  28. 28. 7. We love duck http://www.flickr.com/photos/ymorimo/3975152607/
  29. 29. Duck typing • If it quacks like a duck, it’s a duck! • Check for object’s property, not interface
  30. 30. Duck Punching!
  31. 31. 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
  32. 32. 8. Testing is FFFF**... (FFFFUUNNN)
  33. 33. Encourage testing
  34. 34. 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
  35. 35. Testing tools • RSpec • Cucumber • Test::Unit • Rack::Test
  36. 36. 9. RubyGems
  37. 37. Libraries in Ruby
  38. 38. http://rubygems.org
  39. 39. Gem • Library written under Ruby or C • Packaged by owner and upload to RubyGems.org • Easy to install, just gem install gem_name
  40. 40. 10. IT’S FUN!
  41. 41. Question? Thank you! Prem Sichanugrist @sikachu http://sikachu.com 3.9454 in Beautiful Software

×