Lessons from my First Open Source Contribution
Tags: opensource, career, motivation, beginners
Published: 2017-05-16 18:18:22

---
title: Lessons from my First Open Source Contribution
published: true
description: What I learned by going through the process.
cover_image: http://jarviscity.com/wp-content/uploads/2015/09/alice-in-wonderland-rabbit-hole.jpg
tags: open source, career, motivation, beginners
---

When I graduated from my coding bootcamp, I had a lot of ideas of how to get a job and be the 'ideal candidate'. You've probably heard it all already:
* "Contribute to open source projects!"
* "Write technical blogs!"
* "Study algorithms!"
* "Don't study algorithms, you're wasting your time!"
* "Learn [_insert popular framework_]; everyone is using it!"
* "Network with devs/recruiters/companies!"
* "Work on side projects you're passionate about!"

Now it's all good advice, but I ended up just studying and keeping to myself because I felt like I didn't have anything to contribute to others. _"Who would read anything I write?"_ and _"I can't add any value to Rails or Angular,"_ were some of the thoughts that made me doubt myself. 

On top of that, I became a teacher assistant at my coding bootcamp, **giving me an excuse to be complacent and do less.**

![Patrick from Spongebob crossing off "Nothing" on a checklist](https://media.giphy.com/media/26ufnwz3wDUli7GU0/giphy.gif)
<figcaption>Clearly easier to do nothing.</figcaption>

Thankfully, being a TA exposes me to [beginners who always have questions to ask](https://dev.to/ben/dont-silence-yourself-just-because-you-are-less-experienced), and one of those questions led me to my first open source contribution to [the Ruby gem Faker](https://github.com/stympy/faker) - a library that generates fake data. And no, I wasn't just trying to add more Star Wars quotes; there was a different problem.

### The Problem, and Supposed Solution

My student was trying to use a class in that gem that generates a [link to an image of Bill Murray](http://www.fillmurray.com/). However, when running the method with the default arguments, I got an argument error:

```
NoMethodError: undefined method `match' for 200:Fixnum
```

I looked into Faker's codebase, and checked out the method:

```ruby
    def image(grayscale = false, width = 200, height = 200)
        raise ArgumentError, "Width should be a number" unless width.to_s.match(/^\d+$/)
        raise ArgumentError, "Height should be a number" unless height.to_s.match(/^\d+$/)
        raise ArgumentError, "Grayscale should be a boolean" unless [true, false].include?(grayscale)

        grayscale == true ? "https://fillmurray.com/g/#{width}/#{height}" : "https://fillmurray.com/#{width}/#{height}"
    end
```
Well, nothing looked wrong with the method to me, but neither my student's machine nor mine ran the code successfully. I checked to see if our versions matched the latest release, and it did. Perhaps the default arguments weren't being converted to strings with `to_s`, and therefore the `match` method was being called on `200` as a Fixnum.

So, I ended up forking it down, making some edits to seemingly fix it, ran the code in my console, and it worked! I followed the contributing guidelines, and made [my first pull request.](https://github.com/stympy/faker/pull/908)

### The Real Solution
![Disney Alice in Wonderland falling down the rabbit hole](https://media.giphy.com/media/swtiK9jRfE0zS/giphy.gif)
<figcaption>Into the rabbit hole we went...</figcaption>

A few days later, I got a response. Someone had the same question, wondering why the code in the codebase didn't work. They asked me what my Ruby version I was running, and also if I could explain the bug. I got why he asked about my Ruby version, but I also didn't understand why the original code didn't work. I checked and updated my Ruby version, then ran the code. Got the same error. Hmm...

Then it hit me: maybe my local Faker files weren't correct. I spent a few minutes figuring how to locate them, and then I opened the file. Lo-and-behold, my local file's method didn't convert any arguments to strings!

But I had the latest release; why wasn't my code matching the code on GitHub? So, I searched the issues, and noticed that the date of the merged pull request was after the latest release. I closed my pull request, and finished my first open source contribution!

### Now... what did I learn?

While it really wasn't much of a contribution, I'm glad I went down the wrong rabbit hole. I learned a lot more about contributing to open source than I would have if I simply noticed my local files were not up-to-date. 

There were a bunch of technical details, too, but what was really important to me was that I started working again. **When I wasn't doing anything, the momentum was against me: it was easier to do nothing than it was to do something.** Now I'm writing technical posts again after feeling too shy about it a few months ago. The more I work, the more confident I feel to do more.

With all that, I hope you've enjoyed reading my post! I'll definitely be writing again. Until then, fellow devs.