Blog Post:My Rollercoaster Journey with Code Reviews, Bugs, and Fixes đ˘
madhur Saluja
Posted on September 14, 2024
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! đ
Posted on September 14, 2024
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.
Related
September 14, 2024