66
Getting Your Ruby EGOT Channel Your Inner Tracy Jordan

Getting Your Ruby EGOT

Embed Size (px)

DESCRIPTION

Slides from the presentation that I gave in Berlin at EuRuCamp 2013.

Citation preview

Getting Your Ruby EGOT

Channel Your Inner Tracy Jordan

EGOT?

Emmy

Grammy

Oscar

Tony

Ruby EGOT?

MRI

JRuby

Rubinius

MacRuby

MagLev

Topaz

...

Ruby EGOT?

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

I want my EGOT!

The Bug

Matz’s Ruby Interpreter!

string.c

Find the method...

Hint: grep is your friend!

Oh, MRI...

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

The Fix

JRuby!

core/src/main/java/org/jruby/RubyString.java

Find the method...

Well, if MRI does it...

The Fix

The Fix

The Fix

Rubinius!

kernel/common/string19.rb

Find the method...

The Fix

The Fix

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...

The Fix

Topaz!

topaz/topaz/objects/stringobject.py

Find the method...

The Fix

The Fix

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