---
title: The opportunity will find you
teaser: 'Learning makes magic happen.

  '
tags: learning
author: Matheus Richard
published_on: 2022-03-21
---

In this article, I'll tell you three real-life short stories. If you're don't like stories, you can
[skip to the conclusion].

## A boy and his dream

When I started writing Ruby, one of my biggest dreams was to create a gem, i.e., a Ruby library. It
**had** to be useful and cool so that everyone would use it. Those constraints proved to be quite
hard to meet, so I ended up not writing any gems at all.

Skip a few years. I discovered this other language called [Crystal]. It is similar to Ruby, and as a
form of exercise to grasp it, I tried to port a Ruby gem into a Crystal shard (another word for
library). In the process, I studied some [famous gems] and [API wrappers] to understand how they
structured the code. In a way, my first gem was a Crystal shard. I did it for fun, closed the
editor, and didn't think about it anymore.

The **very next week**, I was assigned to create an internal gem at work.

## It's trees all the way down

A friend introduced me to the book [Crafting Interpreters]. While I didn't give it attention at
first, I quickly fell in love with it after reading a few paragraphs. I was so excited to learn
about <abbr title="Abstract Syntax Tree">AST</abbr>s, s-expressions and [visitors][]!

<aside class="info">
  <span style="font-style: normal;">🤔</span> Am I weird for getting excited about <em>these</em> things?
</aside>

A few months later, working at thoughtbot, I saw the opportunity of creating [custom RuboCop cops][]
to automate tedious tasks. Guess how those cops work? Walking the AST of your code and matching expressions
with a regex-like pattern that uses s-expressions.

## Rusty skills

Okay, one last story. Last year, [out of nowhere], I decided to pick up Rust. I've been a Ruby
developer for a long time, so I thought adding a systems language to my arsenal would be helpful. I
mainly focused on what I was most interested in --- building interpreters --- and did not dive into
anything work-related like web apps, servers, databases, etc.

Well, I guess you already know what I'll say here. Even though I still consider myself a Rust
beginner, this week I am part of the discussion about thoughtbot's first Rust client.

## Okay, what is the point?

<blockquote>
  <p>
    Every now and then one's mind is stretched by a new idea or sensation, and never shrinks back
    to its former dimensions.
  </p>

  <p><cite>Oliver Wendell Holmes Sr., Autocrat of the Breakfast Table</cite></p>
</blockquote>

What's going on? Does learning make something magic happen? It _does_! Sort of. Not that the stars
will suddenly align the right way for us, but knowledge changes how we see the world. It's like when
you travel, come back home and start seeing things a bit differently.

When you know a tool, you'll see an opportunity to use it when it shows. Maybe you did Functional
Programming, and when you go back doing your Object-Oriented Programming, you'll see yourself using
anonymous functions and [operation pipelines] more often. Or maybe you spent some time with
Elixir/Rust, and now you care about shared, mutable state and parallelism in your Ruby code.

<aside class="warn">
  Be careful with over-engineering things just because you're excited about a tool! Often the best
  solution is the <a href="https://thoughtbot.com/blog/start-simple">simplest</a> one.
</aside>

On the other hand, the world around you changes too! People know that you have that new skill, so
it's more likely that they will remember you when that competence is needed.

The gist is: wanna work with language/tech X? Don't wait for the perfect use case to learn it. Start
learning it, _then_ the opportunity to use it will come
up.

[crystal]: https://crystal-lang.org/
[famous gems]: https://github.com/ruby/rake/
[API wrappers]: https://github.com/sferik/twitter
[crafting interpreters]: https://craftinginterpreters.com/
[out of nowhere]: https://www.matheusrich.com/on-learning-rust/
[skip to the conclusion]: #okay-what-is-the-point
[visitors]: https://eli.thegreenplace.net/2016/the-expression-problem-and-its-solutions/
[custom RuboCop cops]: https://thoughtbot.com/blog/rubocop-custom-cops-for-custom-needs
[operation pipelines]: https://thoughtbot.com/blog/pipelining-without-pipes-in-ruby
