I imagine the typical perpetrator in that case is a man with negligible romantic experience, who is not particularly attractive, lives in a social environment with a 10:1 M:F ratio and statistically may well be encountering someone of the opposite sex who actually nominally has something nontrivial in common with them for the first time. The "something in common" part is contingent on actually signalling being a capital-p Programmer culturally (e.g. by blogging about programming), rather than someone who appears to be closer to a social activist who just happens to have a job in programming (and might as well be the secretary staffing the front desk for the purpose of commonalities, as far as the would-be harasser can see).
Grasping at straws inevitably ensues, and there are sufficiently many around that some don't react gracefully when the straws snap.