Contributing to Open-Source Projects

Today I would like to share what I have learned from the very little open-source contributions I have made so far. But before I do that, I would like to write a little bit about myself. I am ruby on rails developer at JoshSoftware for the past 3 years. Before that I was studying Electronics in Pune Institute of Computer Technology, Pune. Yes.. you read that right. I was an electronics student in computers college. The reason I am laying out the details is, I do not want you to think that I am some big shot who has been working for a decade. I am just a guy who likes to write programs and do web development.

So, here is the list of hurdles I came across until I made my first open-source contribution:

1. Which projects should I contribute to?
Thats a valid question. There are tons of projects out there. How do I find out about these projects? In my case I have been very fortunate to work on open-source technologies, and at a company that promotes doing contributions. My daily work tool involves ruby which is an open-sourced language and rails an open-source framework. Starting with ruby, when I say I code in ruby, it also heavily involves using gems (aka libraries). As of today, there are 91,349 gems hosted on rubgems.org. That means I have at least 91,349 open-source projects to contribute on. And rails, I think contributing to rails is so easy, not because the code is simple to understand, it is not. But because of the community. Everyone helps you out if you are stuck at something. Here is an example:
I had sent a pull request with different commits. I had added example for squish method, remove method and a test case for that.
os1
In my diff, you can see there is an extra line added which is not needed. And Zachary Scott , a member of rails core team, asks me to remove that extra line.

Now, I also saw that extra line while submitting the pull request, but I just ignored it. Because I did not knew why that line came even after I have not added it. So I send him a screenshot of the code at my end that I have no extra line break.
os2

And then Eileen M. Uchitelle came to my rescue, who I have never met in person and she has nothing to do with the pull request that I have sent, but she still helped me out. See it here:
os3
So it was not a new line, but an extra space or a tab.

Now, another rails committer Vijay Dev gets involved with the PR, and asks me to squash all commits into 1 big commit. I did that and I sent a new PR with squashed commits. And then Abdelkader Boudih, who is also part of the rails core team, asks me to force push it. It is exactly the reason I sent a new PR because I wanted to avoid force push.
os4
And then he asks me to remove the “[ci skip]” tag from the commit. Because I have added a new test case. In case you do not know, if you have made changes like changing documentation, then there is no need to run the test cases for such PR. But I have a new test case, so I had to remove the ci skip tag.
os5

So, you can clearly see the mistakes I have made, and how everyone helped out. Here is the PR.

2. Am I good enough?
It is something that I still ask to myself. Am I good enough to contribute to somebody else’s project, may be I should work for 5 more years and then I will make contributions. But believe me, you are good enough to contribute to any project you like from the day you start writing that “hello world” program in your favourite language. The only regret that I have is why did I start so late … why it took me at least 2 years to make that first contribution. Because contributing to open-source projects is not just about sending a PR for a new feature that you wish to see or fixing a critical bug which nobody seems to solve. There is so much more to it. You can help out in documentation, you can add comments to methods explaining what they do or you can fix failing test case or add a new one which you think the author has missed.

One of the best ways to start contributing is by observing what kind of pull requests other developers send, and you will start finding a pattern in those which will help you send your first PR.

3. What will I gain from it?
Satisfaction, Recognition, Learning. These were the main reasons I started contributing in the first place.

I think these are the main hurdles I faced.I hope this blog post helps some of you and you can avoid the mistakes I have made. And it would be great, if you could share your experience of contributing to open-source projects. Mention it in comments or tweet me at jainrishi15 if you have a similar post and I will try to include it in the blog post.

UPDATE:
I came across this post by PJ Hagerty which is about how and why to contribute to ruby.

Advertisements

2 thoughts on “Contributing to Open-Source Projects

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s