- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
So you could be Male, Female, Transgender, FILE_NOT_FOUND, Business, Company, and/or a number?
Admin
And gender and sex of a person can differ.
Admin
2 : ISCOMPANY 3 : ISACROWD
Admin
6 and 9 for sex. Is it just me or does the programmer have a dirty mind too?
Admin
Been there, witnessed the idiocy, learned a lot of things I should never do. In my first job I had to maintain a bunch of broken WTF-laden bug-ridden projects. One of the systems I was afflicted with had a char(1) Gender field in its Customers table that would hold 'M', 'F' or 'J'. Naturally 'J' meant that that customer was a company, but that was really one of the minor WTFs I experienced while I was there.
Admin
Makes you wonder what clients this company was catering to ... !
And I remember having some pointless argument with a some know-it-all on linkedin who was banging on about NoSQL. His entire argument seemed to rest on how difficult it was for him to write SQL statements that would cope with his gender field, which he'd set as a nullable Boolean "isMale".
Several people telling him "do it properly first, then come back and present a better example!" didn't seem to dissuade him.
Just looked him up, he now describes himself as a Big Data Architect, god help his poor clients.
Admin
comapny? co_map_ny?
Admin
TWF?
Admin
Trypogaphical error, most likely...
Admin
I see lots of this sorts of stuff. It's taking a standard, misunderstanding then misapplying the misunderstanding.
ISO5218 defines gender code 9 as being Not Applicable.
A company is a legal person, a person has gender but gender is not applicable to an organisation. Not even Ann Summers.
The best data modelling advice I was ever given was to model your data for the physical thing you are modelling. Don't force a physical thing to comply with a logical construct, you will rue the day.
Admin
TRWTF is the reversed indentation on the cases.
Admin
so have the actual integer values been changed to protect the submitter? Or is that REALLY what they used?
Admin
I created a similar mess when our database admins would not let me add a few boolean flags. I ended up stuffing the flags into an unused "FAX phone number" field. Not proud of that!
Admin
I worked on a system for several years that had Gender defined as 0, 1, or 2. 0 Was unknown or N/A, 1 was Male, 2 was Female. On some screens and reports, those got converted to U, M, and F, but on most they just showed the number. Worked a project that converted most of the data into a relational database, at the time we decided it was time to just start storing U, M, and F on the table. Was a lot bigger mess to make that work than you would think.
Admin
Pogaphical or pogaphical not: there is no try. (Although, if there were one, it would presumably use instanceof.)
Admin
Misspellings like ISCOMAPNY are reflections of either confusion or lack of attention to detail. They are bigger red flags than some may think. Maybe foreign contractors less so, but just maybe.
Admin
Yep. Currently work at a company where the "FAX" field is used to store about 5 different types of information, none of which are anywhere close to being a phone number & you require a (basically none existent) data dictionary to map between many of the database fields original use and current use.
Admin
It is also possible that SEX does not mean gender. I worked with Apple quite a few years ago; one of the columns they sent us was SEX, but this was physical location data (maybe apple stores, I forget). No longer remember what SEX stood for, but there were literally hundreds of these three-letter acronyms which defined some aspect of whatever locations we were interested in.
Admin
Unfortunately, I've seen something like this more than once. This is likely "we don't want to create a new field in the database, so take this dis-used field and just use it for whatever you need."
Admin
The Real WTF is DBAs that believe they can dictate what can an cannot be in the database (rather than just dictating structure)
Admin
So now companies, legal entities, have gender identities? I see that there are TWO values for "is a company" sex/gender. So, which is a 6, and which is a 9? And what if a company is transgendered? ...or any of the other gender identities?!?!?!?
(Well if legal corporate entities can "have" religions, and freedom of religion rights, then I suppose that corporate gender identity makes sense too. :-/ )
Admin
INB4 Corporations are people too.
Admin
Did that myself, last week, had a parameter listed as "FOBOAR" when of course it should be "FOOBAR". Now I'm propagating the misspelling through stored procedures and SQL jobs. Why? Because I don't yet get to change the web site code in production where the spelling error is. Oh sure, I can just add a real "FOOBAR" parameter, but then the SQL code has to explain why there are two very-similarly named parameters existing. And when I correct the spelling next time, of course I'll remember to search-and-replace it throughout the database.
Admin
And yet you avoid maybe the first dozen and possibly a few domain specific ones, your app will run correctly long after you're gone. Even most of the gender stuff is only an issue if you work for Tumblr, everyone else can, in practice, treat "changing gender" exactly the same as correcting a typo.
Admin
Naming things, and counting things.
Admin
At my former company, we had an online coding test that we would give to job applicants. Whenever I was grading a test and saw obvious misspellings in comments - or worse, in function or variable names - I would call it out as at least a yellow flag, if not a red one. If you can't take a minute to proofread your code before submitting it, then yes, I question your attention to detail and to writing maintainable code.
Admin
… or an indication that some programmer needs to visit their local optician for new spectacles :-)
Admin
Give them an API with a few subtle misspellings and see if they keep that too. A few APIs we use (external and internal) have misspellings. Instead of fixing it they just get documented.
Admin
Are the values 6 and 9 (69!) the ACTUAL values from the actual code? Cause for sex, that's pretty awesome.
And 69 is definitely company. :)
Admin
Gender is really quite simple: Have an integer that counts the number of X chromosomes. That ought to do it.
Admin
Oh dear, people are confusing "gender" with "mood" again.
Admin
Transgender is still male or female, just not immutable.
Admin
Sex <> Gender
Admin
Gender and sex are annoyingly complicated in medical software.
First, because it's critical to know not just the patient's gender identity, but also the state of their reproductive biology. A transgender individual might be a male but have functioning female reproductive organs, and thus one might need to take a potential pregnancy into consideration when considering a course of treatment. Both of these are critical but separate pieces of information, and each of these is also potentially distinct from the patient's legal gender as it appears on official identification, which can also be distinct from their insurance subscriber details.
Second, because medical systems need to exchange data with hundreds or thousands of external systems even within one single hospital system, huge numbers of systems only accept a single "M" or "F", and even the newest standards for information exchange lump gender identity, sex, and legal gender into a single field with no support for anything except "Male", "Female", "Unknown", or "Other". Even if your system has the right information, a round trip through a third party can cause all kinds of headaches because the vocabulary of the standard is insufficient to describe the data you're exchanging.
Admin
I expect this crap of liberal arts majors, not programmers. If a simple system covers 99.99% of cases, and the other 0.01% don't really matter, then don't make it more complicated than it needs to be. Gender is Sex, and it is binary almost all the time. People who don't fall into the binary categorization know they're special, and they can deal with it.
What programmers need to know about gender:
The list of cases where MALE/FEMALE is sufficient just goes on and on and on. There are so few exceptions to the MALE/FEMALE dichotomy that they aren't worth wasting time on.
Admin
On the point 4, so people are attracted to TG, so it would be better that your dating site takes care of them too.
Admin
Sex 6? 9? Depends, is it metric or imperial?
Admin
Pro-tip: when an expert says something is complicated...believe them.
Admin
Fair. Conversely, some people will not be interested in TG. But "M/F looking for M/F" covers the vast majority of cases. Look, people know what they want. On a dating system they want sex, and they want a particular kind of sex. That means they're looking for people with the right anatomy: specify that, and the system can start finding matches. The details can go in the bio. I know things get complicated. They want someone with the right political views, the right religious beliefs, the right age, the right tax bracket. But the sex? Not really so complicated.
Admin
It might be a right call as changing name would probably break everything that uses this API,
Admin
You're fired.
Admin
Yes, we have a few of these. When I see them, I insist that whoever is responsible for maintaining this code put a comment upside this code telling anyone else with good attention to detail that this is a known misspelling, and please do not at this stage suddenly decide you're going to fix it.
Admin
6 = Male, 9 = Female, null = Not a person = Is a company. Or?
Admin
I am also reminded of an advert in a local paper which had obviously been written by a complete numpty, advertising a local clothing store. "Clothes for all sexes," it crowed, "men, women and children!"
Admin
I guess "Intersex" or "Androgynous" would have been more correct for the term I was aiming for.
Admin
I thought that business sex was prohibited. Clearly the author of that pattern should be arrested for pandering.
Admin
@completemisogynist,
I agree with the gist of your comment, KISS is always good advice. However, as to the specifics of gender, in medical applications one cannot simply "leave the doctors to fill in the details". Male and Female require different handling from someone who is female born male and v.v. Those men who choose to become women require significant doses of drugs to maintain their dubious femininity. For a clinician treating such a patient, knowing this information could be crucial. Also, since there's no paper involved, where exactly does a clinician fill in the details? How does one clinician leave a record of why the diagnosis and/or treatment for this female is apparently wrong - unless the system makes provision for it?
Apart from that, I totally concur with your comment.
Admin
Gender used to be a Boolean, then enum, then an integer. What's next, double precision float?
Admin
Wouldn't a medical application include a medical history section for patient records? Just put it there.
Admin
Sex is the biological bit, gender is what you identify as, that's how it is used in a medical context. Whether you need to make the distinction, depends on what you are using the data for .... lazy assumptions are the problem, as always with databases.
And neither are or ever were binary, that's the reality. Again, it might be for your application binary is good enough, but assuming it's immutable is assuming your data is always cleanly entered, and that's never true!
Anyway, this WTF seems to be that they couldn't be bothered categorising client type and just relied any record with something else in that field as being a company. I get 9 being the ISO for not applicable, but what's 6? If you are going to use a scruffy hack like that at least put a grovelling apology in the comments field.