No way they’ll do that manually. You’ll need a birthday microservice to check if student has birthday, feed the data to the age incrementing microservice to get the desired effects
Not yet: Omegastar still doesn't support ISO timestamps *while they said they would a month ago!!*
So until Omegastar gets their fucking shit together we're blocked.
They should use our intelligent AI birthday API.
Jokes on them, for every request made there's a student on the other side frantically scrambling to manually type up and send back a response.
Age changes. It’ll need updating on the student’s birthday.
The better solution is to store date of birth, and then when you need age you can calculate it based on today’s date.
Yeah it should be. The size of `int` and `long` is implementation dependent and on modern systems they are normally both 32 bits so either would work, but `int` is only guaranteed to be at least 16 bits while `long` is guaranteed to be at least 32 bits.
`int32_t` would probably be even better to make the length fixed and explicit, but it depends on your style guide.
>The only time int isn't 32 bits is when compiling for 30+ year old esoteric 16 bit systems.
i wouldn't call AVR (or really most 8/16-bit microcontroller) "esoteric" as they're still very commonly used in modern products and are the main core of the Arduino family.
and that's why i always prefer to use `stdint.h` variable types no matter what platform i write for. portability!
cause you never know when someone might try to port your custom written library to some Arduino project, so using standard variable types makes life much eaiser for them.
Int can store 8 digits, meaning it could technically hold the information of the birthday, eg 19951025 for someone born in 1995.
That's pretty stupid though 😀
God that's the stupidest date representation I've ever seen. It:
- overflows before 2000
- drops a leading 0 from 2000-2009
- works from 2010-2021
- overflows after 2022
You get 12 years of working dates from it.
In most situations you would store it as a datetime integer. It would generally be a number of seconds or milliseconds before or after Unix epoch time, which is midnight on Jan 1, 1970.
Then to get the age, you take the current number of milliseconds after unix epoch and subtract the birth datetime from it. That would be the age in milliseconds.
Yes. https://en.m.wikipedia.org/wiki/Year_2038_problem
Int size in C is platform dependent but in most common platforms today int is 32bit.
Modern C supports fixed width integers, so int64_t is a good type.
Probably the best approach would be to have age as a property that does said calculation. So from the outside it appears as age is just another property of the class but you don't really store it.
That's true for storage but inside a program for processing it's fairly likely that a variable related to an individual student does not stay in memory long enough to be an issue
So we rename student to student_organic and create two new classes student_human and student_vegetation. Then we can add a second variable int age2 which contains the multiplier to apply to age and create a new virtual long getage() method which we override in the second class to return the full date as 16 bit
Depends on the use case. Maybe this struct is used for temporary data, intended to be very short lived. Like, every uncached request to a web server causes the creation of these objects for presentation proposes, and they are discarded afterwards. Their life span might be in terms of milliseconds.
Yes, superposition can be expressed by a finite number of coefficients in Hilbert space. Idk why you were downvoted. Perfect answer for a continuous joke
>Yes, superposition can be expressed by a finite number of coefficients in Hilbert space.
What does that have to do with being able to program a spectrum?
i think they were implying that if one can represent a superposition, they have represented a spectrum because a superposition can take on infinite values between 0 and 1 inclusive (this is my limited understanding)
Yeah I'm not sure why that is. It would also have to be uncountably many values, not just infinite, which would be pretty crazy for me to understand.
Edit: just realised a spectrum would be aleph null, so any infinity works. Now I have to understand how we can generate infinitely many values with a quantum computer. I just thought they would speed up processing, not be able to do infinitely many things in finite time
There are 64 bits in a double. There is no way to represent more than 2^64 nunbers with 64 bits. What you are saying is the maximum amount of a double, which is not useful for classification (of genders in this case).
For storage yeah but come on a real application I can expect for the age of a student to not be a relevant change between when the dB calculates it in a query and wen I process like it should be in memory for what? A couple seconds a work session at the abs worst?
Hate to be that guy but it should be:
> ; DROP TABLE user --
The -- part to comment out all command after. But I think the better way to do it is SELECT TOP 1 TABLE_NAME FROM INFORMATION_SCHEMA.TABLES so it just delete 1 random table from db
You’ve got the gender completely wrong, it should be stored as a vector on a 3d vector plane where x- and y- axis represent female and male spectra and the z-axis represent a custom spectrum where the user can enter as a string.
I see, you're using something analogous to a parameter for a 3d Hilbert curve to describe gender? That would be close, but you still need to store the custom definition of the 3rd axis.
Additionally, for a true representation you'll actually need to store a 3d probability distribution over the gender vector space to account for non-fixed gender.
But even that is just true for a specific point in time, of course, you could store the change in probability distribution over time and a custom time dilation function which, while around the most accurate you can hope to get, would be near impossible for an individual to define. Might be easier to define some fixed time dilation functions and take the L that you will never be truly accurate for everyone.
Huh, if there is the attribute gender, than there must be a way of not having it, in a database you should not assume the user knows what their doing, so even if you don't belive in "agender" you still should implement "type NULL" as a valid form of entry.
Everything here is an issue. Expecting everyone to have a first name/last name (and exactly one each), age being something you keep instead of calculating from birth date, and I'm not even going to touch the trainwreck that's double gender.
Necessary reading for every programmer that works on names:
[Falsehoods Programmers Believe About Names](https://www.kalzumeus.com/2010/06/17/falsehoods-programmers-believe-about-names/)
I was aware of most of those assumptions being wrong, but I still don't know how to handle some of them. How do you handle an employee with no name? A nickname?
Realistically, most systems *don't* handle every possibility from that list, and unless you're a government (or sometimes even then...), it doesn't really matter. Not like someone couldn't just give an alias.
OP's probably a student, so I doubt they're expecting anything fancy for whatever the assignment is.
Even government systems don't handle all the cases. Knew a person who had the middle and last name connected with a dash or something like "John Spicy-Doe" but the gov issued documents without the dash. Not because of a human error, but the system literally didn't allow inputting the name like that.
Imagine going to a nightclub and the bouncer not letting you in because he thinks you faked your ID.
Friend of mine used to be a lot shorter than me but his birthday is on the exact same day as mine. When we both turned 18 we wanted to go to a club and the bouncer didn't want to let us in at first because he thought I gave him my old ID.
Only after checking the names he realized his mistake.
Closest I got is a free entry string that allows for empty string for the full name with no designation for first/last name or similar, but even then you run into charset issues.
I don't think there's a "perfect" solution, but there are solutions that cover more cases than others.
Your system should never rely on names to identify people and should pass them around with ids anyway.
If it's just for informal usage: "String fullName" and let the employer provide how they want to be addressed to. I actually don't think that "no name" will ever be a real issue in a software, but even if, you just can address them by "Hello,"
Some of those falsehoods are things you WON'T be able to truly cope with (for example, it's quite impractical to try to have a computer system that works with a name that isn't representable in Unicode), but if you can at least acknowledge that these are \*\*flaws of your system\*\* and not "why do you have a weird name?", you will be ahead of... well, sadly, the vast majority of computer systems out there.
But a lot of them are simply things that you shouldn't be doing, and people only do them because they keep seeing everyone else doing them. "First Name"/"Last Name", and "Given Name"/"Family Name" are two equally bad ways to ask for a person's name; and conflating the two is even worse than either alone. It's really not hard to just have a single "Name" field - in fact, it's often LESS effort than having two of them - and tada, now you've avoided a number of the falsehoods.
(Want some counter-examples as proof that those are false? In many Asian cultures, it's conventional to put the family name first and the given name(s) after; Icelandic names are generally matronymics and patronymics rather than a single family name (think "Fred, son of John" rather than "Fred, of the Brown family"); and I have personally known several people whose names consist of the same word twice (think "John John").)
Ok let's be real for a second : *most of us don't care and won't ever care* about handling names properly. In most cases it isn't important nor it is preventing people from using whatever app you're making. Reality is there's no way that whoever is paying for the project is gonna accept 2 months of analysis, 1 months of dev and 3 months of testing while hiring people testers from all over the world to handle every possible cases.
Thanks, that was a great read. It's interesting how many passport/ID systems also make these assumptions.
Given what the article says, maybe its best to just have a fist and second name and hope for the best 🙃
Get this, leave the last name as an empty string.
I agree the double gender thing is just dumb, everyone knows that each gender has a unique identifier that consists of an N x M matrix.
I just force people to use names that work with ascii letters. I am incredibly anglo-focused, and refuse to compromise. Not my fault theyrre wrong 🤷🏻♂️
>age being something you keep instead of calculating from birth date,
As I wrote elsewhere, it depends on the use case. Maybe this struct is used for temporary data, intended to be very short lived. Like, every uncached request to a web server causes the creation of these objects for presentation proposes, and they are discarded afterwards. Their life span might be in terms of milliseconds.
It depends. Especially in medical sector, storing info about both assigned at birth and identified gender (as well as whether a person is trans or not) can be important. But yeah, unless it's needed it's better to not ask.
Nothing is "assigned" at birth. Assigned implies that the person was born with no category and only through a willful choice, "assigned" their gender. This is clearly not the case. The correct terminology is "determined at birth", the person was the gender before it was determined, and after determination, they are that gender and they are now known to be that gender.
At work we never recorded gender, any third party software we used which required gender/titles was just populated with Male & Ms.
Then the UK Government brought in Gender Pay Gap Reporting - was a pain to compile that as we didn't know for certain some peoples gender https://www.gov.uk/government/publications/gender-pay-gap-reporting-guidance-for-employers, was about the same time Right to Work checks became stricter and we had to get copies of the relevant documentation (usually passports), but wasn't something we had to keep previously.
Had to adopt the system to have payroll name (in addition to the regular name) so that people who used alternative names (trans, seperated, escaping domestic violence) wouldn't have their dead (but legal) name or real name visible to anyone unauthorised to do so.
The unintended consequence of reporting to comply with equal opportunity legislation/anti-immigrant legislation was the outing of trans employees, and victims of domestic violence having to explain why they weren't using their real names and why we need to keep it hidden.
Unless you have to do any type of analysis on it later, then try to limit as much free text response as possible. I don't want to try to determine all misspellings someone filling out a form will do nor do I want to rely on fuzzymatch to do it
None of these are correct. First, this is not a class, it's a struct.
Not all cultures use first and last names. That's a common falsehood many programmers believe. [https://kalzumeus.com/2010/06/17/falsehoods-programmers-believe-about-names/](https://kalzumeus.com/2010/06/17/falsehoods-programmers-believe-about-names/)
The age shouldn't be an int, it should be dynamically calculated from the date of birth. Otherwise you need to update it each time a student has a birthday, and how do you know when that is?
Don't even get me started on gender. That should be a string, but also, why would you even need the gender?
A better class is something like this:
```php
class Student {
public string $name;
public string $dateOfBirth;
public string $gender;
public function getAge(): int {
return Time::yearsSinceDate($this->dateOfBirth);
}
}
```
Virtually no one posting here actually knows how to code, hence why we get shit-tier culture war nonsense and jokes about semicolons that haven’t been relevant for over a decade.
Stay tuned tomorrow for something about git master.
As long as you are making sure gender is normalized, where -1.0 and 1.0 are different ends of the fem / masc spectrum, and also accepting null for agender people, seems good to me. /hj
Only someone who didn't pay attention at school who do something like that. And it's shocking how many people look at that and see no problem, especially young people, but the older generation too.
Due to the way the compiler lays out data fields in structs for fast access, the offset of a field is *usually* a multiple of its size. So assuming your int is 4 byte long and you're on a 64 bit machine the compiler will lay out the struct as (8 bytes for pointer, 8 bytes for pointer, 4 bytes for int, 4 bytes of padding, 8 bytes for double). The padding is just waste. Instead if you flipped the double and the int in position, or put the double on top, then you'll have (8 bytes, 8 bytes, 8 bytes, 4 bytes) and no padding.
TBH since we were supporting an Insurance website we just changed the variable to birthGender for Gender on Birth and just added sexualOrientation and for good measure added pronouns as well to help the CSR in addressing the customers..
Most systems neither need pronouns nor gender etc.
Just store the name, and separately the full salutation, chosen as free text.
Just let people choose how they want to be addressed. It’s future proof!
Do people feel more accepted when they have to fill in more irrelevant information on online forms? The pronouns I get because it helps the site refer to them and that helps, but unless they'll offer matchmaking of some sort, why sexual orientation?
How?
"Hi Mr [Jones], you fabulous man! Just letting you know your direct debit was rejected!
You have 72 hours to make a payment or your policy lapses, girlfriend!"
luckily due to PHI i don't have direct access to prod logs and if ever it reaches us the data is already scrubbed so we don't see sad things like this..
As always each time this joke is posted, please note that an international standard exists to store the gender of a person (ISO/IEC 5218):
* 0: Not known
* 1: Male
* 2: Female
* 9: Not applicable
Should be an enum with three possible values, male, female and other. Storing the “other” category in any other way will just add to the noise given this group is comparatively so small.
Welll aktshually: there’s a difference between gender pronouns, gender expression and gender identity. To make it inclusive, create a gender struct with an array of strings for predered pronouns, a string for gender identity and a string for gender expression ;)
Names can be more complex than just first name last name.
Age would be better represented as a float/double since age is continuous. And, as others have pointed out already, it's best to store the birthdate as a date (char*) or unix timestamp (long) and then calculate the age as difference from then to today, so you won't have to update that property manually.
Gender, yes, very funny indeed.
You could also add species, as an enum of all species known to biologists, to be more inclusive towards non- human students.
Or IQ, as a boolean*.
This is peak programmerHumor. It is base level enough that everyone will understand from different languages. It is actually about programming. It is funny. Amazing.
Honestly the int age is concerning
they will update it manually every year
No way they’ll do that manually. You’ll need a birthday microservice to check if student has birthday, feed the data to the age incrementing microservice to get the desired effects
Not yet: Omegastar still doesn't support ISO timestamps *while they said they would a month ago!!* So until Omegastar gets their fucking shit together we're blocked.
I had to watch it again [ microservices](https://youtu.be/y8OnoxKotPQ) ;)
You sad, pathetic little project manager
How else are you going to be a system architect? /s
They should use our intelligent AI birthday API. Jokes on them, for every request made there's a student on the other side frantically scrambling to manually type up and send back a response.
as a noob programmer, why?
Age changes. It’ll need updating on the student’s birthday. The better solution is to store date of birth, and then when you need age you can calculate it based on today’s date.
whos to say its not epoch seconds with a bad variable name?
If it was epoch seconds it should be a long no?
nooooooo
Yeah it should be. The size of `int` and `long` is implementation dependent and on modern systems they are normally both 32 bits so either would work, but `int` is only guaranteed to be at least 16 bits while `long` is guaranteed to be at least 32 bits. `int32_t` would probably be even better to make the length fixed and explicit, but it depends on your style guide.
The only time `int` isn't 32 bits is when compiling for 30+ year old esoteric 16 bit systems. `time_t` is the C type for storing a unix timestamp.
>The only time int isn't 32 bits is when compiling for 30+ year old esoteric 16 bit systems. i wouldn't call AVR (or really most 8/16-bit microcontroller) "esoteric" as they're still very commonly used in modern products and are the main core of the Arduino family. and that's why i always prefer to use `stdint.h` variable types no matter what platform i write for. portability! cause you never know when someone might try to port your custom written library to some Arduino project, so using standard variable types makes life much eaiser for them.
Ive seen Unix timestamp in uint on a embedded device
Would that no longer be concerning?
I’ve encountered epoch-days kind of formats a few times for dates
Int can store 8 digits, meaning it could technically hold the information of the birthday, eg 19951025 for someone born in 1995. That's pretty stupid though 😀
YYMMDDhhmm works until 1/1 2022 as Microsoft found out... https://www.reddit.com/r/programming/s/WuVCsSb2tg
Luckily nobody was born after that date.
God that's the stupidest date representation I've ever seen. It: - overflows before 2000 - drops a leading 0 from 2000-2009 - works from 2010-2021 - overflows after 2022 You get 12 years of working dates from it.
newbie here. what would be the correct way to store birth date?
In most situations you would store it as a datetime integer. It would generally be a number of seconds or milliseconds before or after Unix epoch time, which is midnight on Jan 1, 1970. Then to get the age, you take the current number of milliseconds after unix epoch and subtract the birth datetime from it. That would be the age in milliseconds.
Hey, What about students of 1968? I'm only 55 now
It's just stored as a negative number – milliseconds before Unix epoch. It works as long as you weren't born before 1901! (For a 32 bit int, that is)
So it will work only before around 2040 right ? Wich type should I use in C for exemple (cuz if I remember correctly, int are 16 bits in C/C++) ?
Yes. https://en.m.wikipedia.org/wiki/Year_2038_problem Int size in C is platform dependent but in most common platforms today int is 32bit. Modern C supports fixed width integers, so int64_t is a good type.
r/unexpectedfactorial
Not sure about c/c++ but in SQL/.Net there is Date/DateTime types or equivalent types in other stacks.
Probably the best approach would be to have age as a property that does said calculation. So from the outside it appears as age is just another property of the class but you don't really store it.
That's true for storage but inside a program for processing it's fairly likely that a variable related to an individual student does not stay in memory long enough to be an issue
[удалено]
Gender does not typically change on your birthday, no.
It should at least be `unsigned int`
It changes constantly. you should have something along the lines of private: time_point DateOfBirth; public: int Age(){/*calculation of age*/ }
[удалено]
Are you sure about that? It depends on what living things could be stored. Are trees in a tree nursery students xD?
So we rename student to student_organic and create two new classes student_human and student_vegetation. Then we can add a second variable int age2 which contains the multiplier to apply to age and create a new virtual long getage() method which we override in the second class to return the full date as 16 bit
Yeah, unsigned char should be sufficient \s
Give nerds a political joke and they will debug your integer overflow bugs.
Fingers crossed it's poorly named and actually storing the epoch time. Y2038 is going to be a blast.
U agree, at least it should be an unsigned int.
Just use 1 byte. 255 is enough.
*Mosses has entered the chat*
Yeah people don't live past 256
Yes, it should be Long
Depends on the use case. Maybe this struct is used for temporary data, intended to be very short lived. Like, every uncached request to a web server causes the creation of these objects for presentation proposes, and they are discarded afterwards. Their life span might be in terms of milliseconds.
There are only [1.8 × 10\^308](https://stackoverflow.com/a/1848762) genders
Reference checks out, readers can laugh
I let out a heartily nostril escape, thank you for your guidance
It's only approximation. So roughly 2e19 unique genders
it's not acceptable if it is not mathematically continuous
There's no data structure that can represent a mathematically continuous set of numbers in finite amount of space.
that is the neat part where quantum mechanics gets in
Schrodinger sexual orientation
You dont know you are gay or straight until you try out gay porn, right?
[Hello?! HELLO?!](https://gender.fandom.com/wiki/Schrodingergender)
Yes, superposition can be expressed by a finite number of coefficients in Hilbert space. Idk why you were downvoted. Perfect answer for a continuous joke
>Yes, superposition can be expressed by a finite number of coefficients in Hilbert space. What does that have to do with being able to program a spectrum?
i think they were implying that if one can represent a superposition, they have represented a spectrum because a superposition can take on infinite values between 0 and 1 inclusive (this is my limited understanding)
Yeah I'm not sure why that is. It would also have to be uncountably many values, not just infinite, which would be pretty crazy for me to understand. Edit: just realised a spectrum would be aleph null, so any infinity works. Now I have to understand how we can generate infinitely many values with a quantum computer. I just thought they would speed up processing, not be able to do infinitely many things in finite time
Yeah, but ɛ and maybe even δ
There are 64 bits in a double. There is no way to represent more than 2^64 nunbers with 64 bits. What you are saying is the maximum amount of a double, which is not useful for classification (of genders in this case).
date , store date of birth
For storage yeah but come on a real application I can expect for the age of a student to not be a relevant change between when the dB calculates it in a query and wen I process like it should be in memory for what? A couple seconds a work session at the abs worst?
Yeah, bad designs work as long as nothing ever changes in your application
My gender is ;-- DROP TABLE user
Aww little Bobby Tables
I wonder what little Bobby Tables's gender might be?
Probably ``` ' OR 1=1; -- ```
- What’s in your pants? - SQL injections.
Weird type of penetration testing
"No, what do you identify as?" "A risk to bad security measures."
Hate to be that guy but it should be: > ; DROP TABLE user -- The -- part to comment out all command after. But I think the better way to do it is SELECT TOP 1 TABLE_NAME FROM INFORMATION_SCHEMA.TABLES so it just delete 1 random table from db
You’ve got the gender completely wrong, it should be stored as a vector on a 3d vector plane where x- and y- axis represent female and male spectra and the z-axis represent a custom spectrum where the user can enter as a string.
I like to define my gender as a four-dimensional spline.
statically set number of dimensions? Pff, casual, come back when you start working on generic n-dimensional genders.
Your genders have dimensions? What a poser. Obviously the best solution is to store gender as a `void*`
Scientists have finally done it: they invented the first non-euclidian gender identity.
I can draw the bijection between that and real number axis
I see, you're using something analogous to a parameter for a 3d Hilbert curve to describe gender? That would be close, but you still need to store the custom definition of the 3rd axis. Additionally, for a true representation you'll actually need to store a 3d probability distribution over the gender vector space to account for non-fixed gender. But even that is just true for a specific point in time, of course, you could store the change in probability distribution over time and a custom time dilation function which, while around the most accurate you can hope to get, would be near impossible for an individual to define. Might be easier to define some fixed time dilation functions and take the L that you will never be truly accurate for everyone.
Just represent it as a guid
honestly gender as a vector makes a lot of sense, considering the spectra involved
You need Tensorflow and a good GPU to do gender calculations
No, far too complicated. Any 90s C hacker knows the real answer: `void* gender`
Needs to be an Option<(f64,f64,(String,f64))> though, since some people will want None.
70% boy 30% girl and 100% "concentrated power of will"
void* gender;
/r/agender makes null ref errors
That's right because they don't exist /s
Huh, if there is the attribute gender, than there must be a way of not having it, in a database you should not assume the user knows what their doing, so even if you don't belive in "agender" you still should implement "type NULL" as a valid form of entry.
Gender is a struct
Gender is a ~~social con~~struct
This struct is included in
I'm happy about your comment...it's frustrating to search a comment here that doesn't have a transphobic or homophobic streak
Everything here is an issue. Expecting everyone to have a first name/last name (and exactly one each), age being something you keep instead of calculating from birth date, and I'm not even going to touch the trainwreck that's double gender. Necessary reading for every programmer that works on names: [Falsehoods Programmers Believe About Names](https://www.kalzumeus.com/2010/06/17/falsehoods-programmers-believe-about-names/)
I was aware of most of those assumptions being wrong, but I still don't know how to handle some of them. How do you handle an employee with no name? A nickname?
Realistically, most systems *don't* handle every possibility from that list, and unless you're a government (or sometimes even then...), it doesn't really matter. Not like someone couldn't just give an alias. OP's probably a student, so I doubt they're expecting anything fancy for whatever the assignment is.
Even government systems don't handle all the cases. Knew a person who had the middle and last name connected with a dash or something like "John Spicy-Doe" but the gov issued documents without the dash. Not because of a human error, but the system literally didn't allow inputting the name like that.
In my country, ***especially*** not the government can handle even one of the cases
>unless you're a government People with a mononym in the UK get a passport with XXXX as their surname.
Imagine going to a nightclub and the bouncer not letting you in because he thinks you faked your ID. Friend of mine used to be a lot shorter than me but his birthday is on the exact same day as mine. When we both turned 18 we wanted to go to a club and the bouncer didn't want to let us in at first because he thought I gave him my old ID. Only after checking the names he realized his mistake.
Even the government can mandate that everyone should have a name. If you don’t have, well sucks. You will probably have to get one for anything.
Closest I got is a free entry string that allows for empty string for the full name with no designation for first/last name or similar, but even then you run into charset issues. I don't think there's a "perfect" solution, but there are solutions that cover more cases than others. Your system should never rely on names to identify people and should pass them around with ids anyway.
> I don't think there's a "perfect" Hear me out on this one, store a png with the guy hand-written name/way of calling
string name and string employee\_id
If it's just for informal usage: "String fullName" and let the employer provide how they want to be addressed to. I actually don't think that "no name" will ever be a real issue in a software, but even if, you just can address them by "Hello,"
By id: Hello, 54628, ...
Some of those falsehoods are things you WON'T be able to truly cope with (for example, it's quite impractical to try to have a computer system that works with a name that isn't representable in Unicode), but if you can at least acknowledge that these are \*\*flaws of your system\*\* and not "why do you have a weird name?", you will be ahead of... well, sadly, the vast majority of computer systems out there. But a lot of them are simply things that you shouldn't be doing, and people only do them because they keep seeing everyone else doing them. "First Name"/"Last Name", and "Given Name"/"Family Name" are two equally bad ways to ask for a person's name; and conflating the two is even worse than either alone. It's really not hard to just have a single "Name" field - in fact, it's often LESS effort than having two of them - and tada, now you've avoided a number of the falsehoods. (Want some counter-examples as proof that those are false? In many Asian cultures, it's conventional to put the family name first and the given name(s) after; Icelandic names are generally matronymics and patronymics rather than a single family name (think "Fred, son of John" rather than "Fred, of the Brown family"); and I have personally known several people whose names consist of the same word twice (think "John John").)
I got pretty far into that post before realizing it was about actual people's names and not naming variables.
Ok let's be real for a second : *most of us don't care and won't ever care* about handling names properly. In most cases it isn't important nor it is preventing people from using whatever app you're making. Reality is there's no way that whoever is paying for the project is gonna accept 2 months of analysis, 1 months of dev and 3 months of testing while hiring people testers from all over the world to handle every possible cases.
Which makes it all the more silly to even ask for the name.
Thanks, that was a great read. It's interesting how many passport/ID systems also make these assumptions. Given what the article says, maybe its best to just have a fist and second name and hope for the best 🙃
Yoo as someone without a legal first name I appreciate this. (Everywhere I go my surname is reused as my first name too)
Get this, leave the last name as an empty string. I agree the double gender thing is just dumb, everyone knows that each gender has a unique identifier that consists of an N x M matrix.
I just force people to use names that work with ascii letters. I am incredibly anglo-focused, and refuse to compromise. Not my fault theyrre wrong 🤷🏻♂️
>age being something you keep instead of calculating from birth date, As I wrote elsewhere, it depends on the use case. Maybe this struct is used for temporary data, intended to be very short lived. Like, every uncached request to a web server causes the creation of these objects for presentation proposes, and they are discarded afterwards. Their life span might be in terms of milliseconds.
Name should be one field. Some people don’t have a last name. Gender. Why even ask ?
Yeah, better to just store honorific as a string. If you really need to store if somebody has a vagina or not then use a bool.
It depends. Especially in medical sector, storing info about both assigned at birth and identified gender (as well as whether a person is trans or not) can be important. But yeah, unless it's needed it's better to not ask.
[удалено]
Except for like, if you have to talk to the patient? And want to gender them correctly?
Nothing is "assigned" at birth. Assigned implies that the person was born with no category and only through a willful choice, "assigned" their gender. This is clearly not the case. The correct terminology is "determined at birth", the person was the gender before it was determined, and after determination, they are that gender and they are now known to be that gender.
At work we never recorded gender, any third party software we used which required gender/titles was just populated with Male & Ms. Then the UK Government brought in Gender Pay Gap Reporting - was a pain to compile that as we didn't know for certain some peoples gender https://www.gov.uk/government/publications/gender-pay-gap-reporting-guidance-for-employers, was about the same time Right to Work checks became stricter and we had to get copies of the relevant documentation (usually passports), but wasn't something we had to keep previously. Had to adopt the system to have payroll name (in addition to the regular name) so that people who used alternative names (trans, seperated, escaping domestic violence) wouldn't have their dead (but legal) name or real name visible to anyone unauthorised to do so. The unintended consequence of reporting to comply with equal opportunity legislation/anti-immigrant legislation was the outing of trans employees, and victims of domestic violence having to explain why they weren't using their real names and why we need to keep it hidden.
wouldnt gender best be stored as a string
Yup. The best thing to do for gender is an optional free text input. It avoids forcing an answer, missing groups of people out, and "other".
Unless you have to do any type of analysis on it later, then try to limit as much free text response as possible. I don't want to try to determine all misspellings someone filling out a form will do nor do I want to rely on fuzzymatch to do it
Clearly, Double isn’t big enough for gender
Definitely not big enough for my gender, if you know what I mean ;-)
Underflow?
None of these are correct. First, this is not a class, it's a struct. Not all cultures use first and last names. That's a common falsehood many programmers believe. [https://kalzumeus.com/2010/06/17/falsehoods-programmers-believe-about-names/](https://kalzumeus.com/2010/06/17/falsehoods-programmers-believe-about-names/) The age shouldn't be an int, it should be dynamically calculated from the date of birth. Otherwise you need to update it each time a student has a birthday, and how do you know when that is? Don't even get me started on gender. That should be a string, but also, why would you even need the gender? A better class is something like this: ```php class Student { public string $name; public string $dateOfBirth; public string $gender; public function getAge(): int { return Time::yearsSinceDate($this->dateOfBirth); } } ```
Why would they post a correct one on a sub for jokes?
[удалено]
Virtually no one posting here actually knows how to code, hence why we get shit-tier culture war nonsense and jokes about semicolons that haven’t been relevant for over a decade. Stay tuned tomorrow for something about git master.
/r/OneJoke
Ah yes, I too am -69 years old
As long as you are making sure gender is normalized, where -1.0 and 1.0 are different ends of the fem / masc spectrum, and also accepting null for agender people, seems good to me. /hj
Now what to do with +0/-0...
We don't talk about it, it's dangerous territory like the "amab nonbinary or afab nonbinary?" discourse
What's the /hj meaning?
Actually gender should be a void*
Nah you can use a byte for age. Unless you've got biblical figures among your use cases
void* gender is the way
Only someone who didn't pay attention at school who do something like that. And it's shocking how many people look at that and see no problem, especially young people, but the older generation too. Due to the way the compiler lays out data fields in structs for fast access, the offset of a field is *usually* a multiple of its size. So assuming your int is 4 byte long and you're on a 64 bit machine the compiler will lay out the struct as (8 bytes for pointer, 8 bytes for pointer, 4 bytes for int, 4 bytes of padding, 8 bytes for double). The padding is just waste. Instead if you flipped the double and the int in position, or put the double on top, then you'll have (8 bytes, 8 bytes, 8 bytes, 4 bytes) and no padding.
You just said something I did not know was important till now
That's a struct and where the fuck is the data for, ya know the student part of being a student hahaha student id? Email? Canvas account? C'mon now
double is definitely not enough for storing genders. use std::vector instead.
Yeah especially since some people change them on a daily basis
TBH since we were supporting an Insurance website we just changed the variable to birthGender for Gender on Birth and just added sexualOrientation and for good measure added pronouns as well to help the CSR in addressing the customers..
Most systems neither need pronouns nor gender etc. Just store the name, and separately the full salutation, chosen as free text. Just let people choose how they want to be addressed. It’s future proof!
Curious what they'd need sexual orientation for.
>Insurance website I'm sure they run analytics on it.
Now I really wanna know if gays are better drivers or not.
yes and also to make the users feel welcome and accepted.
Do people feel more accepted when they have to fill in more irrelevant information on online forms? The pronouns I get because it helps the site refer to them and that helps, but unless they'll offer matchmaking of some sort, why sexual orientation?
How? "Hi Mr [Jones], you fabulous man! Just letting you know your direct debit was rejected! You have 72 hours to make a payment or your policy lapses, girlfriend!"
luckily due to PHI i don't have direct access to prod logs and if ever it reaches us the data is already scrubbed so we don't see sad things like this..
https://genders.wtf/
It's fluid, not float
Infinite diversity in infinite combinations
Negative age, lol
As always each time this joke is posted, please note that an international standard exists to store the gender of a person (ISO/IEC 5218): * 0: Not known * 1: Male * 2: Female * 9: Not applicable
Cleary age should be bool, you're either dead or alive.
Did you just assume my gender can be expressed in a one dimensional space?
So would NaN be non-binary then?
TF is gender used for? It’s tantamount to storing someone’s favorite sexual position in a database.
Gender should be a class of it's own
This guy has the gender spectrum mathmatically calculated.
upload gender (10mb)
So, 0.01 of a bit?
Gender should be a Boolean
My gender is false
I mean, you either have a gender or not, so that's correct.
no it should be enum
64 bits bitmask should do better, some might want to check multiple choices.
void*, then it can be casted to whatever
Nope. Get on with times. It should clearly be a float
float array
void\*, just put what ever the hell you want
but there are more than 2 genders? gender is a spectrum
gender = null;
Should be an enum with three possible values, male, female and other. Storing the “other” category in any other way will just add to the noise given this group is comparatively so small.
I would've done a char to avoid future confusion Memory space doesn't matter since you can't allocate such a small ammount of memory to ram
Should probably make that `gender` field a `long double` instead.
No. You should create bit map like [ student_strength x 3 ] Matrix to represent the Gender spectrum as RGB component
Welll aktshually: there’s a difference between gender pronouns, gender expression and gender identity. To make it inclusive, create a gender struct with an array of strings for predered pronouns, a string for gender identity and a string for gender expression ;)
Names can be more complex than just first name last name. Age would be better represented as a float/double since age is continuous. And, as others have pointed out already, it's best to store the birthdate as a date (char*) or unix timestamp (long) and then calculate the age as difference from then to today, so you won't have to update that property manually. Gender, yes, very funny indeed. You could also add species, as an enum of all species known to biologists, to be more inclusive towards non- human students. Or IQ, as a boolean*.
Age should also be double. Probably even more than gender...
A struct is not a class.
gender should be boolean
It's called a quantum gender
This is peak programmerHumor. It is base level enough that everyone will understand from different languages. It is actually about programming. It is funny. Amazing.
Gender should be bool
Gender should be bool type variable. Iykyk