👨🏫 Lessons Learnt from Open-Source
This is a reflection of my open-source journey, from which I had some invaluable learnings along the way.
I joined GitHub back in 2012, primarily to use it for collaboration across our hackathon projects.
My first open-source contribution was to an online judge. It was the summer of '13 and I had just learnt PHP and MySQL. While browsing through potential issues on GitHub (read opportunities), I had found one issue which was a complete feature in itself and simple enough for me to handle. The maintainer was very friendly and supportive, which I think motivated me a lot to continue contributing.
Happiness is getting your pull request merged!
But everything had to be tested manually before merging. Since there were not many collaborators, it worked fine for that project but eventually the lack of regression testing caught up and the project was shelved.
In the next year, I mostly used GitHub for backup purposes. I had a repo containing my solutions to various programming challenges, project euler problems, machine-learning assignments (👋 Andrew Ng), and more. I also had one repository where I used to compress (zip) various work-in-progress projects and just dump those files. You see, I was (am) very skeptical about losing data!
My first real project was a chrome extension, which was a helper tool for a competitive programming website. I was using it a lot those days and had recently attended a browser-extension workshop in my college. It was probably less than 10 lines of code, but the encouraging words on their forum got me on cloud 9. I didn't realize it then, but it was addictive! I got hooked.
Happiness is when someone stars your GitHub project.
Back in 2015, GitHub used to show the longest streak and the current streak, where a streak is the number of consecutive days that you have contributed (committed code, filed an issue, reviewed a pull request, etc.) to any public GitHub project. I decided to challenge myself on how long can I go without missing a day. It was an intense period of time, because thinking of what to do everyday was tougher than I had presumed. I started a lot of projects during that time, and got to know a lot about other more popular projects. I also open-sourced many of my lab projects, just because I had nothing to commit on some days. I dabbled in bash scripting, python, ruby, go, etc. I ended up having a streak of 209 days, eventually stopping because I ran out of ideas! Looking back, I consider this period to be the major turning-point. I had basically gone all-in on open-source!
After the streak, I was quite familiar with the collaboration workflow, what kind of projects get popular, how to make it easy for users to try your project, etc. The only thing missing was getting involved in a large-scale project. That's how I came across duck-duck-go. It was a large codebase being maintained by multiple people. This is where I really learnt the importance of tests. If you change a single line, that might affect functionalities at 3 different places. If I recall correctly, there were more than a 1000 tests that used to run on every pull request, giving the contributor quick feedback and the reviewer a much-needed peace of mind.
Later that year, I also started one of my most-popular projects to date, jarvis. I tried to incorporate many of the things that I had learnt along the way. If you're a maintainer of an open-source project, here are some tips for you:
- You have to take a lead. You shouldn't expect the project to grow without your push.
- Define who's working on what. You'll save everyone's time that way! Duplicate work does not help anyone.
- Automate all the things! I'm guilty of being very particular about the order of imports and code style. I probably spent a lot of time on things I could have automated.
- Get collaborators on-board. There's no shame in asking for help. I had an enthusiastic person wanting to become a maintainer of jarvis back in 2016. But I was too possessive of my code. I couldn't fathom the idea of someone committing directly to master without me reviewing it first. And that is something I regret to this day!
I did a 4-month streak in early-2018 to get back on track. But as soon as I broke the streak, it snowballed. I then thought of relaxing the constraints of contributing (basically allowing very small changes to count as well) if it led to more contributions in the longer run. I started my current streak after a few months again in 2018, and it has worked out pretty well till now (more than 400 days and counting!).
Right now, I'm at a place where I don't have the time to maintain old projects or start new ones. I have 500+ PRs pending to review which already feels like a nightmare! This is the most profound change that I have seen in myself:
Before starting a new project, you search whether something like that already exists. 5 years ago, I'd jump in excitement when it didn't (opportunity for me!). The current me prays that the project already exists and is well-maintained (never thought I'd say this! 😅). I don't want to maintain more projects!
https://twitter.com/SwapAgarwal/status/991442353234771968
If you'd like to become a maintainer on any of my projects, let me know by replying to this mail. Feel free to ask any specific questions as well.
Until We Meet Again...
🖖 swap