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 ASTs, s-expressions and visitors!
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.
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?
Every now and then one’s mind is stretched by a new idea or sensation, and never shrinks back to its former dimensions.
Oliver Wendell Holmes Sr., Autocrat of the Breakfast Table
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.
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.