A good way to stir up some controversy is to bring up possible differences between the way men and women write code. Add to it a tone that suggests that women write better code, and you'll really get people talking. Is there something to it? Would you really be able to tell the difference between male and female code, and could you really say that one is better than the other?
Programming computer applications involves writing multiple lines of instructions that will be turned into something a computer can understand. When writing these instructions, or code, a programmer can also add extra information that the computer will ignore, called comments. To get a bit of an idea of what code is all about, go to ‘View, Page Source’ on your browser to see what a web page really looks like. When we ask about the differences between code that men and women write, we are talking about what instructions are used, what style is used to write them, and what kinds of comments are included.
A story was recently featured on Slashdot, a news website geared towards nerds like us, called Men Write Code from Mars, Women Write More Helpful Code from Venus – I think you’ll probably agree that even the title sets the ‘women are better’ tone! This article describes how “Emma McGrattan, the senior vice-president of engineering for computer-database company Ingres – and one of Silicon Valley’s highest-ranking female programmers – insists that men and women write code differently.”
Apparently, McGrattan believes that women’s code tends to include more useful comments than men’s. She says that women use comments to explain what they were thinking when writing their code so it is easy to understand by programmers that haven’t seen it before. On the other hand, she suggests that men actually try to make their code more cryptic, with fewer useful comments, in an effort to show how clever they are. To help fix this problem, she set up rules and standards for Ingres programmers to follow, forcing everyone to document their code, and any changes they made to other peoples’ code, with detailed comments.
The comments section back at Slashdot has some interesting reaction. One reader says:
It’s now well established that the human brain builds negative stereotypes more easily than positive ones and that people see what they are expecting and apply a double standard. This person sees what she wants to see.
Another points out:
Personality is complex, not binary. I know many girls that code beautifully, and many more that can not code at all.
The general theme throughout the comments is that men and women do think differently, but that neither writes better code than the other, nor could you really tell the difference arbitrarily.
Interestingly, there seems to be a good selection of research trying to determine whether men and women write English compositions differently. One study concludes that “there are indeed different strategies employed by men and women in setting forth information and especially in encoding the relation between writer and reader in texts.” In other words, there are apparently several indicators that can help decide fairly reliably whether a text was written by a male or female, such as the number of personal pronouns (I, we, you) used in place of noun specifiers (much, some). Could this difference extend to how men and women write code, too?
From my own job experience in two different companies, I can say that I was very careful to write useful comments, and was even complimented for it. While some of the guys did occasionally forget to add in the same kind of detailed comments that McGrattan is asking for, many of them wrote just as many comments as I did. On the flip side, some of the girls I worked with barely wrote any at all! In my case, it really did seem to depend on the person, not the gender.
So what’s the answer to the question of whether women write better code than men? And is it possible to tell the difference between women’s and men’s code just by looking at it? There may be some noticeable trends like those found in English composition, but this has yet to be scientifically studied as far as I know. Besides, until women make up a little closer to half of the programming workforce, how can we do a fair comparison? I think we’ll have to mark this one down as inconclusive for now, though I’m leaning toward a no for the part about women writing better code. What do you think?