I'm not a programmer and I don't know the specific environment that she described, but I'm a female motorcyclist and I've worked in lots of kitchens and a couple in molecular biology labs. I know the behavior and I've dealt with it. Men behave in curious ways when there's a low female/male ratio, but in my experience, half of it comes out of awkwardness or plain old stupidity on the other side. Some of the more honest comments on this thread testify to that.
The other half is intended to belittle. But seriously, this isn't just at work. This is walking down the street in the city. This is buying something in the store. This is sitting on the bus. And as much as it sucks, getting offended doesn't help.
If this sounds like a long winded "lighten up," please think of it more as a friendly "toughen up." It's the only way to signal the change that you want.