Top 10+ Things
 Every .NET Developer
Should Know About Ruby

       Jeff Cohen
       @jeffcohen
jeff@purpleworkshops.com
Windy City Rails
 Sept. 12, 2009

      Essential Javascript
         Oct. 17, 2009

            Rails for Everyone
      ...
Top 10+ Things
 Every .NET Developer
Should Know About Ruby
1. History & Philosophy

SmallTalk    C++   Ruby   Java VB6     C#
 1983       Perl   1993   1995 1996   2000
            ...
1. History & Philosophy



Yukihiro Matsumoto
     "Matz"
1. History & Philosophy

2003 Interview with Matz:
http://www.artima.com/intv/ruby.html

Minimal Interface vs. Humane Inte...
2. irb


 "Immediate Mode"
for Ruby developers
3. Conventions
MyClass

methods_are_in_lowercase

methods_can_be_questions?

some_methods_have_consequences!

methods_can_...
4. Objects

Everything is an object

A class is an object

No "primitives."

You can pass classes around like objects

Eas...
5. Messages

Think in Messages, not Methods

"hello".length

"hello".send(:length)

All message handlers (ok, fine: "method...
6. Blocks

Extremely Common Ruby Idiom

Most Seen in Iterators

Anoymous Methods

Can Be Saved For Later Use (lambda)
7. It's Just a Script


No compilation

A class "declaration" is code that's executing!
8. Dynamic Typing

The type of an object is deduced at runtime

Open Classes

Object-Specific Type (enables Singleton Metho...
In Case You Rant At Me
About The Lack of Intellisense
   It rots your mind:
   http://www.charlespetzold.com/etc/
   DoesV...
9. OOP

Use Modules to Mix-In Behavior

Don't Worry About Interfaces

Duck Typing

No Abstract Classes
10. Metaprogramming
method_missing

Add methods and attributes at run time

Can do prototype-style programming

Rails gain...
11. Even More...

Ruby Class Methods vs. .NET Static Methods

begin/rescue/ensure vs. try/catch/finally

String interpolati...
C'mon in - the water's fine!

  Rails for Everyone
    Oct. 24, 2009
       $395.00
   purpleworkshops.com
Upcoming SlideShare
Loading in …5
×

Top 10+ Things .NET Developers Should Know About Ruby

3,263 views
3,196 views

Published on

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

No Downloads
Views
Total views
3,263
On SlideShare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
29
Comments
0
Likes
3
Embeds 0
No embeds

No notes for slide
  • Class.new => Object Factory
    1.class
    obj.nil?
    hello.methods.sort
  • Top 10+ Things .NET Developers Should Know About Ruby

    1. 1. Top 10+ Things Every .NET Developer Should Know About Ruby Jeff Cohen @jeffcohen jeff@purpleworkshops.com
    2. 2. Windy City Rails Sept. 12, 2009 Essential Javascript Oct. 17, 2009 Rails for Everyone Oct. 24, 2009
    3. 3. Top 10+ Things Every .NET Developer Should Know About Ruby
    4. 4. 1. History & Philosophy SmallTalk C++ Ruby Java VB6 C# 1983 Perl 1993 1995 1996 2000 1989
    5. 5. 1. History & Philosophy Yukihiro Matsumoto "Matz"
    6. 6. 1. History & Philosophy 2003 Interview with Matz: http://www.artima.com/intv/ruby.html Minimal Interface vs. Humane Interface What You Feel > What You Can Do Sapir-Whorff Hypothesis
    7. 7. 2. irb "Immediate Mode" for Ruby developers
    8. 8. 3. Conventions MyClass methods_are_in_lowercase methods_can_be_questions? some_methods_have_consequences! methods_can_set_a_value= @instance_variable MY_CONSTANT or MyConstant or MyClass
    9. 9. 4. Objects Everything is an object A class is an object No "primitives." You can pass classes around like objects Easy reflection/introspection
    10. 10. 5. Messages Think in Messages, not Methods "hello".length "hello".send(:length) All message handlers (ok, fine: "methods") return a value to the calling code
    11. 11. 6. Blocks Extremely Common Ruby Idiom Most Seen in Iterators Anoymous Methods Can Be Saved For Later Use (lambda)
    12. 12. 7. It's Just a Script No compilation A class "declaration" is code that's executing!
    13. 13. 8. Dynamic Typing The type of an object is deduced at runtime Open Classes Object-Specific Type (enables Singleton Methods) Strongly Typed even though not Statically Typed IntelliSense is hard to do
    14. 14. In Case You Rant At Me About The Lack of Intellisense It rots your mind: http://www.charlespetzold.com/etc/ DoesVisualStudioRotTheMind.html It forces bottom-up design It forces linear programming, not free-form experimentation It discourages Test-Driven Development It's a sign that your API is TOO FREAKING BIG
    15. 15. 9. OOP Use Modules to Mix-In Behavior Don't Worry About Interfaces Duck Typing No Abstract Classes
    16. 16. 10. Metaprogramming method_missing Add methods and attributes at run time Can do prototype-style programming Rails gained fame by intelligent usage of metaprogramming techniques
    17. 17. 11. Even More... Ruby Class Methods vs. .NET Static Methods begin/rescue/ensure vs. try/catch/finally String interpolation Other new things: symbols, lambdas, closures No method overloading
    18. 18. C'mon in - the water's fine! Rails for Everyone Oct. 24, 2009 $395.00 purpleworkshops.com

    ×