Monday, August 3, 2009

Cognitive biases and programming languages: some speculative musings

True story: In college, our professor asked our 20-person class what language they thought was better: C++ or Scheme. To this vague question, 19 of us voted for C++; one indignant holdout student (and the professor) said Scheme.

The professor then asked us which of the two languages we had learned first. The same nineteen of us said C++; the same one holdout student had, oddly, learned Scheme some years ago before ever touching an imperative language.

The holdout seized on an explanation for why the rest of the class had the wrong opinion and declaimed without a hint of irony: "You all learned C++ first, that means you're all biased!"

Rational considerations

As a software developer, I often have to choose what programming language to use to implement a new software project. Many rational factors can be weighed; here is an incomplete list:
  • What languages are current and potential project members most proficient in?
  • Is the language a good match for the project's domain?
  • How much does the given language enhance productivity?
  • Is the language well-supported on the target platform?
  • What libraries are available to integrate with in the various languages?
Irrational considerations

Unfortunately, it is all too easy to succumb to irrationality. While I unfortunately have only anecdotal evidence, I believe that we tend to over-rate languages we have learned proficiently, and under-rate languages we are less proficient in. Furthermore, I believe that this holds true even when the pattern of languages we've learned is accidental: while we may learn a language because we over-rate the language, it's also true that we over-rate a language because we've learned it. To further extend my unscientific speculation, here are some possible reasons why we might over-rate our own languages:

* Illusory Superiority. If you're good at basketball but bad at soccer, you will find your brain generating reasons why basketball is more important than soccer, even though we rational people know the reverse to be true.

* Rationalization. If you choose to learn a programming language, you will want to rationalize afterwards that your choice was correct, even if in reality you had far too little information at the time to make an informed decision. If you decline to pick up proficiency in a specific different programming language, you will want to rationalize that you declined because the programming language is inferior, rather than that you were too lazy to explore the new language.

* Ingroup bias. The existence of Internet flamewars shows that we can root for programming languages the same way we root for sports teams.

In evolutionary-psychology terms, the first two are products of evolutionary pressures to project an aura of competence; the third is a product of evolutionary pressures to signal loyalty to your ingroup.

1 comment:

David Pablo Cohn said...

And what a beautiful explanation for actual religious (theological) wars, too!

BTW: Rolf - if you're the former rnelson@google.com, please send me email (at the easily-findable-with-your-favorite-search-engine address).