Writing software is hard, particularly when the schedules keep a programmer's “nose to the grindstone”; every so often, it's important to take a breather and look around the world and discover what we can find-ironically, what we find can often help us write software better.

When programming and psychology mix, usually it draws rolled eyes and heavy sighs from the programmer community. But when push comes to shove, knowing a little about how our minds work can only help keep us honest with ourselves, and potentially identify some of our bad habits.

What We've Got Here… is Failure to Communicate

As many of the readers of this column know already, I spend a lot of time speaking at various conference events, in both the .NET and the Java space. It's a pastime that not only takes me to the four corners of the world, but gives me a chance to meet developers of all different walks of life, and nets me a little spending cash to boot. It's a pretty sweet deal. The catch, of course, is that you have to give the attendees something of a good time, a presentation that's equal parts education and entertainment (hey, let's admit it; some of what we talk about is pretty boring, when you think about it).

A few years ago, though, I gave a talk that, in my opinion, failed on my end of the deal. It wasn't like I didn't prepare for the talk, but for whatever reason, that night the Demo Gods were against me. Every single demo I tried to do, most of which I'd done dozens of times without a problem before , failed. And failed miserably. It was, without question, the Little Bighorn of demos. At one point, I even said out loud, “I give up. I will just not even attempt any more demos.” (Despite that statement, I tried one more… and promptly crashed PowerPoint. And then the virtual machine blue-screened.)

I couldn't get off the stage fast enough. I felt horrible-I'd completely bombed. In between furious coding blasts trying to figure out why the demos tanked so badly, I braced for what I figured would be my worst evaluation scores ever. Other speakers consoled me with things like “It happens, man, don't worry about it”, but in my heart, I knew this was going to be bad.

The evals, as it turned out, were nowhere near the worst I've ever received; in fact, it might be fair to say that they were potentially some of the best I've ever received. In fact, they came in higher than some other speakers whose talks had demos that actually worked. This made absolutely no sense to me. I asked one attendee the next day what eval score he'd given me (something of a breach of etiquette, I admit, but I was flummoxed and wanted some kind of an answer), and he said, “Well, I've seen you speak before, and you're a smart guy, so I just figured you were having an off day and didn't deserve the bad eval score.”

Aristotle, Bell, and You

I wasn't the first to be the recipient of this curious phenomenon. In the days of Ancient Greece, the philosophers used to posit theories about how the body worked based on observation. Aristotle, in particular, had some fascinating theories about medicine, and for many centuries, these were considered the foundation of “modern medicine.” And given how smart Aristotle was (the guy essentially sits at the core of Western philosophical thought), for years, his theories were accepted as fact. Famously, even when Renaissance thinkers opened up a cadaver and demonstrated that Aristotle was wrong about how the body worked, viewers were said to remark, “If only Aristotle had not said otherwise, I would believe you.”

Similarly, one afternoon, a violinist, dressed in jeans, T-shirt and hoodie played outside a subway stop in New York City, and nobody stopped to pay a moment's attention. He played for hours, music wafting past the thousands of people walking past, almost nobody stopping to listen. What the passersby failed to realize was that this was Joshua Bell, a world-renowned violinist, whose tickets for his concert that very night were being sold for hundreds of dollars.

What's happening here? Because Aristotle was such a “smart guy,” clearly anything he said had the automatic benefit of the doubt, even (in his case) becoming the basis for faith. Bell's violin playing clearly couldn't be worth listening to, because the violin player was dressed shabbily and out on the street-if he was any good, he'd be playing in a concert hall, right? And I have to admit, I was the beneficiary of it, too-because attendees had seen me present before with success, they assumed that the fail wasn't entirely my fault, but the work of demo gremlins and their penchant for mayhem.

This is known in psychological circles as “confirmation bias,” and not only can it creep up in the most subtle ways, but it can convince even the most hard-bitten developer of things that simply aren't true.

What Have You Done for Me Lately?

The source of confirmation bias is the brain's tendency to take “shortcuts”-after all, if we had to stop and evaluate everything at every moment, instead of making gross generalizations, we'd be paralyzed with analytical overload: a simple walk down the street would require constant evaluation of every car, every bicycle, every tree, just to spot potential dangers threatening us, much less appreciating the beauty of the world around us or getting to our destination. Think of all the ways that somebody could die walking down the street-including being crushed out of a clear blue sky by falling airplane parts.

It's this same “shortcut” that causes the brain to make a variety of other errors, by the way, including stereotyping and profiling. Those shortcuts are our mind's way of obtaining the most processing out of hardware that's limited to about 40 watts of power (the brain). It's what allows us to look at a round cylinder, slightly-tapered towards the top, open on one end and closed on the other, made of a papery-like substance coated with a wax film, strange iconic logos and words printed all around it, filled with a dark brown liquid substance and think, “Cup. That's my Diet Coke from McDonald's.”

Confirmation bias is a similar kind of shortcut, except one based on experience. If I've been bitten by a dog, and I see a dog growling at me, then confirmation bias kicks in and says, “Time to get out of here.” If I see my favorite sports team lose the game when they fall behind, then the next time they fall behind and lose, I think, “There we go again!” If it happens a third time, it only reinforces my opinion-if the team falls behind and they manage to pull it out, that's the exception to the rule. And so on.

Confirmation bias is particularly nasty when it applies to our perceptions of how other people treat us; marriage counselors and business relationships experts routinely cite a “good-to-bad ratio:” it takes five or so good experiences (compliments, favors, and so on) to erase the memory of one bad experience. Guys, this means one missed anniversary, or one lame Mothers' Day gift completely wipes out that spontaneous trip to the spa you surprised her with. Bosses, one lame “atta-boy” certificate for working overtime completely wipes out… well, whatever good things bosses do.

Rethinking Bias

Unfortunately, this happens a lot even in the hard-core technical arena, too. How many Microsoft-centric developers do you know that automatically assume that anything that comes from Microsoft is great? Or its flip side: how many Linux developers do you know (if any) that automatically assume anything coming from Redmond is trash? Both camps are guilty of making similar errors: judgment based on previous assessments, rather than on analysis of the thing at hand.

In fact, I have a confession to make: I never thought Vista was all that bad. Yes, the UAC thing was annoying, and yes, Vista's performance was at times bad, but I liked the fact that Microsoft was trying to put better security borders around its operating system, and the overall look-and-feel was appealing. (Certainly better than XP's “Crayola” motif, in my opinion.) Remember the “Mojave” experiment? It was a perfect example of confirmation bias: Microsoft showed Vista, rebranded as “Mojave,” to users, and they loved it.

Confirmation bias works in both directions-one doesn't have to peer too hard down the breadth of our industry to spot situations where a tool, technology, or language is given an immediate “WIN” just because of the individual or vendor that promotes it. Remember how much “buzz” built up around Google Wave? I met dozens of developers (admittedly, mostly in the Java/OSS space) who were singing its praises...long before they'd actually gotten an invite or used it.

What, one wonders, would users think of smartphones that can't receive phone calls when held a particular way, or of console gaming devices that overheat and fry themselves, if the vendor brand names associated with those devices weren't present?

Or, for that matter, if presentations could be given anonymously?

(For those interested in a light introduction to confirmation bias and cognitive dissonance, I highly recommend the books “Predictably Irrational,” “Mistakes Were Made (But Not By Me),” and "On Being Certain.")