Skip to content

Instantly share code, notes, and snippets.


luislavena/ Secret

Created Feb 1, 2018
What would you like to do?
Crystal: How using a compiled language made me write better Ruby


We all enjoy the flexibility and expressiveness that languages like Ruby give us, but such flexibility is also paired with the unknown. Dealing with dynamic data and runtime conditions can lead to unknown scenarios and runtime errors.

Compiled languages, specially today offer a fresh perspective and help us developers better understand and shape our code.

This talk aims to discover certain techniques transfered from compiled languages' realm and transfer those to dynamic languages like Ruby. Will talk from my experience working on mid-size Ruby projects (8K+ LOC).


As Ruby developers we all have faced the undefined method for nil, for some, it might flood their exception trackers or haunt their dreams. Because of that, we have invested a lot in testing tools and practices thinking that if our code is well tested (under the known parameters) it will work in real life, right? If not sure, we will add some fuzzy testing and think that perhaps that will be enough. But will it be?

Dynamic languages flexibility is also their Achilles' heel. Today, compiled languages are smarter than their 20-30 years ago counterparts, not to mention the tooling around those.

The experience of working with those modern compiled languages teach us certain techniques that using only a dynamic language wouldn't.

While this task will present Crystal as compiled language and compare against Ruby, it will be mainly focused on code patterns and control flows than the language syntax itself.

We will go over some of the steps of a compiled language to better understand and compare against a dynamic counterpart.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment