DEV Community

Harshil Patel
Harshil Patel

Posted on

Navigating the World of Open Source Collaboration: My First Experience with Code Reviews

Stepping into the world of open source can be intimidating, but also incredibly rewarding. As part of my Release 0.1, I got to dive deep into collaborating with the wider community, specifically with my classmate Nonthachai Plodthong—whom I call Non. Together, we embarked on a journey to test, review, and improve each other’s code, and it was quite an experience!

Working Together: Sync or Async?

Non and I decided to take an asynchronous approach for our collaboration. This meant that we communicated via messages and GitHub issues rather than live calls or meetings. I found this method preferable because it allowed us both to work at our own pace. Whenever one of us had time, we could review messages, test code, or open issues without feeling pressured by the other's schedule. Plus, it gave us time to think deeply about the feedback we provided to each other.

Testing and Reviewing Non's Code

Reviewing and testing someone else's code was a unique challenge. I chose to work with Python, which is relatively new to me. This decision turned out to be a great learning opportunity; by going through Non's Python code, I learned a lot of new things about the language that I hadn't known before. Initially, I was worried about running into problems, but whenever I hit a wall or didn't understand something, Non was quick to clarify, which made the process smoother.

My Code Under the Microscope

Having someone else test and review my code was an eye-opener. Non identified several issues that I hadn't noticed. At first, I felt a little surprised, but I quickly realized that this was the whole point of the exercise: to catch what I might have missed and help me improve my work. Some of the issues Non pointed out were obvious in hindsight, but without his fresh perspective, I might not have spotted them.

Issues Found During the Review

During my review of Non's code, I found a few key issues:

  • API Access Error: The code used a paid OpenAI model by default. Since my API key was a free-tier key, I couldn't access the gpt-4o model. I suggested changing the default to a more accessible free model like gpt-3.5-turbo to improve usability. See the issue here.
  • Output Flag Issue: The -o flag, which was meant to save the output to a file, wasn’t working correctly. However, the longer version, --output, worked fine. I filed an issue to have the shorthand -o fixed. See the issue here.
  • File Input Error: When I tried to use a PDF as an input file, the code threw an unexpected error. I opened an issue to address this problem. See the issue here.
  • Text File Reading Error: Attempting to input a .txt file resulted in a decoding error, which I reported as another issue. See the issue here.

Issues Found on My Repo

Non opened several insightful issues on my repository as well:

  • Add Streaming for Better Response: Non suggested implementing a streaming response to enhance user experience. I updated my code accordingly. See the issue here.
  • Model List Addition: There was no easy way for users to see which models were available, so Non recommended adding a list for user reference. I added this feature. See the issue here.
  • Use of Print Statements Instead of Logger: Non pointed out that I was using print statements for errors where I should have used the configured logger, and I quickly fixed it. See the issue here.
  • Separate If Conditions for Better Logging: Non suggested that I use separate if conditions to log specific errors, which was a great idea for better error handling. See the issue here.

Fixing the Issues: A Journey of Learning

I managed to fix all the issues identified by Non and learned a lot in the process. For example, I got to practice using separate branches for fixing issues and creating pull requests to merge changes back into the main branch. This hands-on experience with Git workflows was invaluable.

Final Thoughts

Overall, this lab was a fantastic experience in learning how to "release early, release often," test code thoroughly, and collaborate effectively with the open-source community. I feel more confident now in my ability to contribute to open source projects, and I’m excited to continue this journey. Thank you, Non, for your invaluable feedback, and here's to more collaboration in the future!

Top comments (0)