http://www.perlmonks.org?node_id=58597

Many of us have blind spots when it comes to reviewing or debugging our own code. We readily see problems in others' code that we're blind to in our own. We know what we just wrote, but our brains can't let go of our intent long enough for our eyes to really see what our fingers just typed. Peer review is the standard way around this, but often we're working alone, without ready access to qualified reviewers, and need to go it alone. Somehow, we need get our minds into a place where we can get past our blind spots.

Several years ago I picked up a way to trick my ego into getting out of the way. I offer it here in the hope that it'll resonate, or at least get others thinking.

My trick is to imagine that I had a fever when I wrote the code I'm now looking at, and that someone else had looked at it and pointed out that there were problems, but hadn't explain what they were.
This has a couple of effects. First, it gets my brain out of "there's no problem here" mode and into search-and-destroy mode. I really, really don't like having others find bugs in my code. (It's that damn perfectionist upbringing.) And to have somebody spot a bug and then not tell me... that gets me fired up even more.

By imagining that I'd had a fever, I sidestep overconfidence, and open my mind to the possibility that I was actually fallible at the time my hands were busily typing. I also pre-excuse myself for any problems that I find. (When I run a fever, my mind can play some mean tricks. I've learned to triple-check anything I try to do while sick.)

Thus tricked, my ego stays out of the way long enough for me to find lurking problems. When I remember to use this technique, my code comes out a lot cleaner.

That's what works for me. What works for you? How do you get your ego our your way?