The whole idea on which genders should be mentioned in a form is broadly discussed in Order of "female" and "male" in survey form
Detaching from the intended contents of your tri-state boolean I'd strongly suggest you to nevertheless use enums (imperative programming) or defined types (functional programming), even if there are only two options possible.
Pros:
- in the implementation you constantly see which parameter and how is being handled
- no chance for mistake (e.g. was true for male and false for female, or was it the other way round?)
- adding new possibility does not force massive code change (extending from 2 to 3 options, and so on)
Cons:
- slight implementation overhead in the beginning (once the enum/type is defined and class/functions are implemented the workload is the same)
- slightly more space usage (e.g. int vs bool), but does it matter with nowadays storage prices?
Reply to OP edit
If you're filtering the data, I'd not be using switch for gender (either male or female, never both) but rather put two checkboxes, one for each gender, where the user can select expected results between "doesn't matter", "option one", "option two"check and uncheck any of the possibilities, "bothbut checking should automatically uncheck any already checked options (logical AND)". It's quite easy for implementation as well.
Even if it is UX level of design, I'd strongly suggest you not talk about types so explicitly. It may hint some less experienced developers to use boolean for gender.
Slightly out-of-topic remark:
Don't use boolean but enums (imperative programming) or defined types (functional programming), even if there are only two options possible:
Pros:
- in the implementation you constantly see which parameter and how is being handled
- no chance for mistake (e.g. was true for male and false for female, or was it the other way round?)
- adding new possibility does not force massive code change (extending from 2 to 3 options, and so on)
Cons:
- slight implementation overhead in the beginning (once the enum/type is defined and class/functions are implemented the workload is the same)
- slightly more space usage (e.g. int vs bool), but does it matter with nowadays storage prices?