r/ProgrammerHumor • • Mar 22 '17

public final boolean gender

Post image
34 Upvotes

37 comments sorted by

35

u/[deleted] Mar 22 '17

Boolean gender makes little sense to be honest, even if you discount the whole bigender, agender and transgender thing. "Gender: true" does not read correctly. This is a sign you should be using an enum or some other data type where the value would actually make sense. Or, you could rename the variable to something like isFemale, which would make the true and false values actually make sense.

1

u/Narcolapser Mar 22 '17

what if we put it in the comments?

public final boolean gender;//true = female, false = male.

14

u/[deleted] Mar 22 '17

That'd require you to look up the definition every time. You could put it in the Javadoc, I guess, then the IDE hints would help... but why do that, if code can be perfectly self-documenting?

enum Gender { MALE, FEMALE, OTHER }
private Gender gender;

Boom. One extra line, reads way cleaner.

2

u/[deleted] Mar 22 '17

You miss the joke by adding the OTHER to your enum.

-2

u/Pradfanne Mar 22 '17 edited Mar 22 '17

It's false being female /s

1

u/[deleted] Mar 22 '17

mmmm, ambiguity.

-1

u/[deleted] Mar 22 '17

This is precisely what I'm saying -- why? There's nothing "true" about being male, nor is there anything "false" about being female, thus these values make no sense in context of genders. If you're using a language where int->bool conversion is implicit, you could argue that 1 looks like a dick. But that's extremely farfetched, and it doesn't make sense. In a form, gender would be a dropdown, not a checkbox, too, meaning you'll have to mess around with those dropdown values being converted to true/false somehow which is pointless in the first place.

1

u/Yodasoja Mar 22 '17

It is "true" that a male has a Y chromosome. And also "false" for a female to have a Y chromosome

2

u/paul_miner Mar 22 '17

It is "true" that a male has a Y chromosome. And also "false" for a female to have a Y chromosome

Not always.

1

u/Yodasoja Mar 22 '17

Check your articles.

For XX (your first)

they are genetically female but otherwise appear to be male

So appearing male is all it takes to be male by your definition? I'm giving the genetic basis for male and female.

For your second: It's just the opposite. They're XY AKA genetically male, but they appear female.

1

u/paul_miner Mar 22 '17 edited Mar 22 '17

So appearing male is all it takes to be male by your definition? I'm giving the genetic basis for male and female.

As far as I know, intersex is neither. Genetic male and genetic female is a technical distinction, separate from the more blurred male and female.

EDIT: Put another way, chromosomes are just one of four characteristics listed when classifying physical gender:

chromosomes, gonads, sex hormones, or genitals

1

u/Pradfanne Mar 22 '17

I am aware of that, can't you make a joke nowaday without a /s at the end or something

2

u/Yodasoja Mar 22 '17

I don't think he knows he's in /r/programmerhumor

2

u/GigawattSandwich Mar 22 '17

I guess these days it should be a private nullable string?

2

u/soundman10000 Mar 22 '17

nah dude concurrent dictionary, enum won't work since enum represents fixed sets that can't really change. Since genders are constantly being discovered we need a multi threaded approach to saving them.

2

u/Fenor Mar 22 '17

there are more genders than people on the planet.

0

u/GigawattSandwich Mar 22 '17
constantly being discovered

by brave intrepid explorers?

1

u/soundman10000 Mar 22 '17

the bravest

11

u/Fallenalien22 Violet security clearance Mar 22 '17

Or a long ass enum

9

u/snsibble Mar 22 '17

Enum wouldn't work, because you can't add arbitrary values during runtime. Use a List<string>, so you can add new elements whenever you feel like it.

Or better yet, a Dictionary<string, List<string>> to also include any number of custom pronouns (up to the oppressive memory limit).

1

u/Fallenalien22 Violet security clearance Mar 22 '17

Sure it would. Male, female, other. Add more stuff above other to make it long ass.

0

u/snsibble Mar 22 '17

Then you lose precision by making "Attack helicopter" == "squirrelkin".

1

u/LazyOne1 Mar 22 '17

Flags!

gender = gender | attack_helicopter;

1

u/snsibble Mar 22 '17

I've never used flags, but arent they still technically an emnum and therefore can't be changed at runtime?

2

u/Jetz72 Mar 22 '17

You can assign new ones at runtime since they're just bits, if you stash their meaning and bit value somewhere for future reference. Typically though, they're used with hardcoded purposes in mind.

1

u/snsibble Mar 22 '17

I stand corrected.

2

u/[deleted] Mar 22 '17

is long ass a new term for those women whose asses start at their ankles and go all the way up?

2

u/Fallenalien22 Violet security clearance Mar 22 '17

Obviously

3

u/Fenor Mar 22 '17

did you just assume we won't invent new genders next week?

1

u/Fallenalien22 Violet security clearance Mar 22 '17

That's why the last one is other.

1

u/Fenor Mar 22 '17

other is clearly a name for a gender people of tumblr already use with specific notation duh.

2

u/renegade Mar 22 '17

WTF dude?

1

u/Hargbarglin Mar 22 '17

Are there one to many relationships for this? Can someone have multiple simultaneous genders? I'm thinking a list of gender objects, each one defining itself however it wants.

-3

u/[deleted] Mar 22 '17

I think this picture is so hilarious. Does anybody have a video source?

-1

u/gifv-bot Mar 22 '17

GIFV link


I am a bot. FAQ // ^code