How I Contribute to Projects

Share this post:

I am writing this article to get a list of points somewhere which I can look back in future for reference. It is also to for others to see and adopt something in case they like it, and for the students I am mentoring during the Kharagpur Winter of Code 2020.

I am that kind of person who likes to have a detailed plan before starting a project. I also like to keep my code clean, with explanatory comments and proper variable names so that I can understand the code I wrote. The focus here is on I because if you cannot understand your code a few months after you wrote it, then nobody can. So think of your future-self and make him/her feel proud on yourself.

Also documenting your thought process makes it easier for your future-self to understand why did you do a specific action.

These points mentioned above are what guide me in the next process. As you can understand, whatever I do, I do it for my future-self. I don’t want him to do the extra work that I could have done beforehand and save hours from the future, and make him feel good.

Before starting the actual work

  • Read the Readme/documentation: The very first task you need to do before starting is to actually read what the project is about. What purpose it wants to achieve. What audience is going to use it. Is it for not-so tech savvy people?
    • If starting a new project, ask yourself these questions and find out the answers.

      Another thing that you can do with an already started project is to use it. This is very important because it lets you get familiar with the different parts and use-cases of that software.

  • Clarify the Why: Why this project? Why this language? Why this framework? Why was this particular process used to develop this feature and all other such questions.
    • Again, if you are starting a new project, think about which language, what framework you should choose and the reasons for choosing it. This is all important because it lets you fix a developmental framework and you can focus on the actual development after this.
  • Select what you would work on: Once you have understood the project and the intentions behind the choices made, you have to select the feature you want to add or the bug you want to fix. Go to GitHub and find out what others tried and how the project contributors would like to build this. It is important because those contributors are going to accept or reject your pull request, and if you work according to what they are expecting, you save yourself from starting all-over again. You should also interact with those who started working on that issue earlier and try and understand what they tried and why it did/did not work out.
    • For a new project, create new issues with what features you would like to have and just start working.
    • If you have already use the software, you already know what you would like to fix and what should be improved.
    • Also consider the difficulty of the task at hand. If you assign yourself to a tough task that you don’t complete later, you wasted a lot of hours — the hours you worked could have been utilized somewhere else, someone else could have started working on the issue and completed it and much more.
    • On the other hand, don’t shy away from asking for help if you are stuck! There is always some help around. Ask other contributors, search on StackOverflow, get help on other programming communities on discord, telegram or even LinkedIn.
  • Layout the plan: After deciding all of this, plan out how you would be completing the task that you have chosen. Is there something on which your work depends? Ask about it from the project owner/contributors. Plan every step that you will follow, draw some diagrams/flowcharts. Share it with others and get approval if needed. Even if an approval is not required, sharing it publicly helps other help you out later or recommend a better way to do your work. Great in both the cases 🙂
    • Even if it is your own work, there is no problem laying out the flowchart publicly, helps the future contributors understand the WHY (seeing this comes around full circle?).

All of this work even before starting writing the code! Don’t worry, it helps reduce the time you spend on the next steps.

While working

  • Share your progress: It’s important that others know about your progress so that they can help you out in case you are stuck, and just to keep them in the loop that you are still working on it. If you stop working, let them know that you cannot work.
  • Ask for help: You get help only if you ask. Ask in the GitHub issues or if they have a developer community group, ask there.
  • Follow clean code practices: I mostly work in Python, so I must follow PEP 8 religiously. Even if you code in another language, reading PEP 8 will help. If there are some code guidelines defined in the project readme/contribution guide, you should follow them. Else, follow the best coding style guides for your language.
  • Write comments: Everyone says this everywhere, so just do it already.

After completing the code

  • (If you are working on my project) Reformat the code using black: I love using black. From its GitHub, “Blackened code looks the same regardless of the project you’re reading. Formatting becomes transparent after a while and you can focus on the content instead.” It is a no-nonsense code formatter, no need to configure anything, just install and use. If you are working on my project, use it before you send a PR.
  • Make any changes: After sending the PR, wait for the reviewer to look at your code. If any changes are suggested, follow-up with those and complete this whole process.
  • Drink some water: You might have forgotten this in between, get a glass of water.

So here it ends. For those of you who are working on my projects, here’s a tldr of the things you MUST do

  1. Use the project first.
  2. Read the documentation and ask any questions.
  3. After you select an issue, share your detailed plan on how you are going to work. Look if there is someone else who is working on it too.
  4. Write clean code and add comments to explain your why.
  5. Reformat the code using black.

 

If there is something you would like to add, or want to discuss, please write it out in the comments!

Share this post:

Leave a Comment

Your email address will not be published. Required fields are marked *