Moving from .NET to Ruby

A set of opinions with which you might disagree

Sean Kelly


Who am I?

I work for Tapjoy

I am a core mainter of...

Chore : Tapjoys Job System in Ruby

Dynamiq : Tapjoys Queue / Topic System ontop of Riak in Golang

Rapp : A scaffolding framework for non-web based Ruby apps

Buffstreams : Streaming Protocol Buffers over TCP made easy in Golang

Before coming to Ruby...

This one might be the most divisive

The (not so) poignent guide to Ruby

I wanted to learn Ruby, not the depths to which madness can drive a person

(But, it probably wasn't aimed at a person like me)

Once I started writing Ruby...

Let's get the obvious ones out of the way

It's slow!

Modules are weird!

Bundler keeps doing a thing I don't understand!

Rspec doesn't make sense!


Sometimes you use them, sometimes you don't

"Am I calling a property or a method?!"

It makes code ambiguous, difficult to read

No Interfaces

My life in .NET was nothing but interfaces

Testing was especially impossible without them

"But how do I KNOW the method is available to be called?!"

No privacy, no hiding anything

Someone made something private?
Nice Try : #send

"Private" instance variable?
Think again : #instance_variable_get/set

Meta Magic

Nothing is ever as it seems

Think you're calling a method?
Nope : Aliasing!

Going to lookup a method definition?
Try again : Dynamically created at run time!

Think you can only call methods that were actually defined in some way?
Swing and a miss : Method Missing!

Prerequisite whining about things in Rails

No set of complaints is complete without it

No "Service" pattern for business logic

Fat Controllers is bad design

Fat Models are ALSO bad design

Keeping business logic in "Service" objects does not make you "too enterprisey"

Active Record Models

What properties does this model have?

Don't bother trying to read the model itself

No real support for custom SQL reports

Yes, you can execute arbitrary SQL

Yes, you can use AREL to build queries

But being able to hand-write reports where it matters easily is important

And AREL is no better than any other SQL building DSL. They're all subpar compared to the real thing

But, it wasn't all bad

I don't have to worry as much about types

Blocks are pretty sweet

The functional-ish side of Ruby is pretty cool

I actually love a lot of this stuff now

It just took some getting used to programming without a net


I didn't like it first, but eventually grew to appreciate what it was doing

Context-driven organization for tests makes sense

It's not perfect, but no testing library is

Meta Magic is great, when used with care

If I had to write a DSL, I'd choose ruby

When you have to, it's great for hotfixing problems

Just because Rails doesn't, doesn't mean I can't

I use app/services and you can't stop me

Turbolinks has an off button for a reason

And Rails is pretty good for most things in general

I still don't care for ActiveRecord

But, it's ubiquitous and works fine ~80% of the time

I can brute force my way around most of the parts I disagree with if I have to

In closing

Programming languages are different

It's ok not to like stuff, even stuff other people say you should like

Things you hate today, could be things you love tomorrow


Moving from .NET to Ruby

A set of opinions with which you might disagree

Sean Kelly