I remember that in our first programming class with Java, while explaining data types, the following occurred (kinda):
Professor: So, what data type would you choose if your program needs
to store the user’s gender?Someone: How about a boolean? You know, true for male and false for
female.Professor: Sure, that may work, but some people may hesitate about that. There
have been disputes about calling men “true” and women “false” in the
past…*laughter *
He ended up recommending us to consider chars (like 'm'
and 'f'
) although booleans should be fine.
I tried searching a bit if there has been any kind of historical entry regarding a major dispute based on this programming practice with no luck.
I’m not asking what data type to use for gender nor if it is fine or not to use booleans. I’m asking if, historically, there has been a dispute regarding the usage of booleans to determine the gender in programming because of the apparently “wrong” (I’m not saying it is wrong – I don’t care about that) behavior of calling a woman “false” as the professor seemed to suggest.
Searching around related questions, the results happen to be only about software efficiency.
17
This is more a cultural issue then technical, and represents a society’s perspective on gender.
If you studied in an Islamic country or China, then I can understand why this would be an issue.
So the answer is no, I’ve never heard of such a silly issue in programming.
1
Never use a boolean just because there are only two values. Unless the meaning of true and false will be obvious, use an enumeration if available, and string constants or symbols or whatever if not. And all too often, there are initially two values and then later there are three. Or four.
4
Besides the reason given by Kevinn, using boolean in this case forces using variable and property names like isMale (or isFemale), instead of gender.
To me, a neutral name like “gender” is much better than “isblabla” as a property name.