DEV Community

madhur Saluja
madhur Saluja

Posted on

Blog Post:My Rollercoaster Journey with Code Reviews, Bugs, and Fixes šŸŽ¢

Ah, code reviews. They're like that first sip of coffee: sometimes smooth and delightful, and sometimes a bit too bitter for your taste! Hereā€™s the tale of my wild ride through reviewing code, getting my own work scrutinized, and fixing all the things that went wrong. Buckle up, folks, because itā€™s going to be fun!

The Code Review Showdown: Sync vs. Async?

When I first dove into code reviews, I quickly realized there are two schools of thought: sync and async. Sync reviews are like having someone read over your shoulder, giving you instant feedback. But I much prefer the async route, where I can take my sweet time (okay, maybe a little too sweet) to really dig into the code. Why rush when you can get cozy, right? Plus, async reviews allowed me to take notes, experiment, and test without feeling the eye-of-Sauron-level pressure of someone waiting on my every move.

Testing Someone Elseā€™s Code: Expect the Unexpected

Testing someone elseā€™s code was like diving into a mystery novel. You think you know whatā€™s coming, but... plot twist! You donā€™t. At first, I ran into some basic bugs like paths not existing, which led to my first issue filed: Improve Error Handling for Invalid File Paths. What surprised me was how something so seemingly small could trip up an entire process.

But the biggest shocker? Discovering a script could hang forever waiting for an API. No timeout? No problem, I thoughtā€”until it became a problem! I filed Add Timeout for API Requests to stop that script from being the Energizer bunny, running forever. šŸ°šŸ”‹

When My Code Got Reviewed: Ouch!

Having someone review my code was a humbling experience. Ever feel like your code is bulletproof, only to have someone point out a glaring security hole? Yeah, me too. Turns out, hardcoding an API URL isnā€™t the best idea in the world. Who knew, right? Hardcoded API URL in api_handler.py was the result of that lightbulb moment. And letā€™s not talk about my exception handling... Apparently, catching all exceptions isn't as cool as I thought (thanks for bursting that bubble, reviewer).

The Bugs, Oh, the Bugs!

A few bugs crawled out of the codebase during testing, and we got pretty friendly. One issue was Non-existent File Handling in main.py. My code kept running even after realizing a file didnā€™t exist. It was like having someone say, ā€œHey, the cake is burnt,ā€ but then continuing to serve it to guests. šŸ˜… I fixed that by making sure the code stopped when the file wasnā€™t there.

Then there was the documentationā€”or lack thereof. My functions were like silent ninjas, doing their job without explaining themselves. Inconsistent documentation made reviewing a puzzle, so I got to work adding docstrings everywhere. (Yep, boring but necessary.)

Issues I Filed:

Here are some of the problems I filed in other repositories, and boy, did I feel like a hero:

1.Improve Error Handling for Invalid File Paths: Because no one wants to process a non-existent file.
2.Add Timeout for API Requests: Letā€™s not hang forever, okay? Just give it 10 seconds and move on.
3.Make Model Selection Configurable: Hardcoding models is cool... until you want to switch things up.

What Did I Learn?
I learned that writing flexible, clear, and well-documented code is essential. Whether it's adding a timeout or handling files better, every small change makes a big difference. The process also made me appreciate code reviews more. Theyā€™re like that brutally honest friend whoā€™ll tell you if youā€™ve got spinach in your teeth. Annoying? Sometimes. Helpful? Always.

Final Thoughts

The code review process is a ride filled with ups, downs, and some unexpected twists, but itā€™s essential for becoming a better developer. Every bug, every line of feedback, and every fix taught me something new. So hereā€™s to more bugs, more reviews, andā€”hopefullyā€”less hardcoded API URLs in the future! šŸŽ‰

Top comments (0)