- Published on
Advent of Pull Requests Best Practice - Day 7
- Authors
- Name
- Nico Prananta
- @2co_p
Let's talk about something that really gets developers talking: variable naming in code reviews. You might think, "It's just a name, right?" But oh boy, it can turn into a heated debate!
Imagine this: You're cruising through some code, and you come across a variable named durationInSeconds
. You'd think it's a simple integer, but plot twist – it's an object! That's not just misleading, it's like expecting a chocolate chip cookie and biting into a raisin one. Ugh.
Or how about this brain teaser: isNotActive
. Now, wrap your head around if (!isNotActive)
. It's a double negative that can make your brain do somersaults. It's like trying to read a sentence that's not not confusing. See what I did there?
They weren't exaggerating when they said that naming things in software development is a daunting task. Even a slightly offbeat name can pile on the cognitive load for anyone trying to decipher your code. In the worst-case scenario: an elusive bug sneaks through and wreaks havoc in production. That's a nightmare scenario for any developer. So, yes, it's completely reasonable to push for name changes in PR reviews if it helps reduce that cognitive load and clarifies things.
📖 Early Bird Offer
Need more insights like this? Jump on our early bird offer and grab your copy for 40% less! This deal is flying off the shelves, so hurry! 🎉