Slides from the presentation that I gave in Berlin at EuRuCamp 2013.
Getting Your Ruby EGOT
Channel Your Inner Tracy Jordan
EGOT?
Emmy
Grammy
Oscar
Tony
Ruby EGOT?
MRI
JRuby
Rubinius
MacRuby
MagLev
Topaz
...
But...why?
Because!
A Side Note on Reading Code
Read Code
A Side Note on Reading Code
Read Code!
A Side Note on Reading Code
Read A Lot of Code
A Side Note on Reading Code
Read Twice as Much Code as You Write
A Side Note on Reading Code
Read Ten Times as Much Code as You Write
A Side Note on Reading Code
Read Code
What’s in a Ruby?
Objects!
What’s in an Object?
Class
Instance Variables
Methods
Data Actions
What’s in an Object?
Class
Instance Variables
Methods
Data Data
Data StructureData Structure
How Do I Build An Object?
Class
Instance Variables
Methods
How Do I Build An Object?
How Do I Build An Object?
Uhh...Josh? RBasic?Glad you asked!
Dirty, dirty tricks!
Dirty, dirty tricks!
Dirty, dirty tricks!
Dirty, dirty tricks!
Dirty, dirty tricks!
How Do I Build An Object?
• Data Structure for Object Data
- Class
- Instance Variables
• Data Structure for Methods
How Do I Build An Object?
With Objects!
C Doesn’t Have Objects!
Java
Objective-C
SmallTalk
Python
Ruby
C++C++
C++! C++!!!
In a perfect world...
• Blocks as arguments
• Crazy Names
• Metaclasses Singleton Classes
• Modules
Matz’s Ruby Interpreter!
string.c
Find the method...
Hint: grep is your friend!
Break it down...
If “other” is a string, do a string comparison(in the else clause...yay)
Break it down...
If “other” can not be converted into a string, return nil
Break it down...
If “other” also doesn’t have its own comparison operator, return nil
Break it down...
If “other” does have its own comparison operator, call it and return the negation of the result
JRuby!
core/src/main/java/org/jruby/RubyString.java
Find the method...
Well, if MRI does it...
Rubinius!
kernel/common/string19.rb
Find the method...
The Fix
in:kernel/common/string20.rb
If you program in Ruby,you can contribute to
Rubinius
MacRuby!
string.c
Find the method...
I feel like I’ve seen this somewhere before...
Topaz!
topaz/topaz/objects/stringobject.py
Find the method...
MagLev!
src/kernel/bootstrap/String.rb
Find the method...
Hmm...primitive_env?
...uh, maybe next time
But...why?
Brain Exercise
But...why?
If you are a programmer...
Ruby is just another program
But...why?
If you are a Ruby programmer...
Ruby is a program you use every day
If you get to know Ruby better...
You will be a betterRuby programmer
KNOW ALL THE RUBIES!!!
Questions?
@manhattanmetric https://github.com/jballanc