(!QuickFix) != (QuickFix != nil)

zeitschlag

Nathan Mattes

Posted on April 14, 2019

(!QuickFix) != (QuickFix != nil)

A colleague of mine works on a pretty important feature. He uses a seperate git-branch for this, so that his changes can be reviewed and thoroughly tested before being merged into the app.

While working on that feature, he fixed some easy-to-fix, but important bugs on this exact branch. In the end, he got stuck due to another reason.

As some customers were waiting for these bug fixes, we wanted to release a new version. We remotely sat together to cherry-pick the bug-fix-commits into their own branch and while doing that, I quickly applied some cosmetic changes. Nothing adventurous, you know, but only minor things to make things more readable. Things like this:

if (!object) { /* ... */ }

turned into this:

if (object != nil) { /* ... */ }

If you're more mindful than I've been over the past couple of days, you might ask: "WTF are you doing?! THIS IS JUST WRONG!". And I have to admit: You're absolutely right, it is. The correct version of this would be:

if (object == nil) { /* ... */ }

I heavily overestimated myself and due to the fact, that these were just small changes, I didn't test the app afterwards myself, because, you know, what could possibly go wrong with these small changes? 😂🙃

Combined with my inattention this turned out to be more or less disastrous: Not one, but two of these changes broke the app. Thankfully, our testing team did a better job. They tested the app before shipping and they complained. I doublechecked my changes and quickly found the wrong code. I fixed it and everything was fine again.

So, hopefully I've learned some things from this:

  • Check everything, even — and especially — tiny quick fixes
  • Even tiny things can break your neck.
  • Don't rush. Take your time to do good work and test it.
  • This can happen to humans. A friend wanted me to include this so you don't feel too bad, if this happens to you, too.

Thanks for reading.

💖 💪 🙅 🚩
zeitschlag
Nathan Mattes

Posted on April 14, 2019

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related