"Research done by the Free University of Bozen-Bolzanohas in Italy concluded that happy software developers are better at solving analytical problems. 'Even simple and short activities', the researchers note, 'may impact the affective states of software developers.'
Many large software companies have been providing various perks to developers, hoping that they will become more productive. Based on a study of 42 students from the Faculty of Computer Science, this research seems to validate that practice. Its findings suggest that 'the happiest software developers are more productive in analytical problem solving performance.' This is in contradiction to previous studies, most of which concluding that negative affective states foster analytic problem-solving performance.
I think that's the Hawthorne Effect [wikipedia.org], where workers improve their performance in response to any change in their environment (positive or negative), simply because they know they're being studied.
A sort of Heisenberg principle for social experiments...
(Though it seems that some of Hawthorne's initial results may have had other explanations.)
Bingo, this section of the Hawthorne entry was particularly interesting, Interpretation and Criticism [wikipedia.org].