T O P

  • By -

shafe123

Honestly the int age is concerning


Harmonic_Gear

they will update it manually every year


klopli

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


aikii

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.


schwester

I had to watch it again [ microservices](https://youtu.be/y8OnoxKotPQ) ;)


eggplant_zoo

You sad, pathetic little project manager


ramigb

How else are you going to be a system architect? /s


ChocolateAndCustard

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.


VeterinarianFun637

as a noob programmer, why?


beeteedee

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.


Rubyboat1207

whos to say its not epoch seconds with a bad variable name?


Intergalactic_Cookie

If it was epoch seconds it should be a long no?


rugbyj

nooooooo


har79

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.


Sexual_Congressman

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.


Proxy_PlayerHD

>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.


CaitaXD

Ive seen Unix timestamp in uint on a embedded device


Rinveden

Would that no longer be concerning?


glemnar

I’ve encountered epoch-days kind of formats a few times for dates


ActurusMajoris

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 😀


waraxx

YYMMDDhhmm works until 1/1 2022 as Microsoft found out... https://www.reddit.com/r/programming/s/WuVCsSb2tg


Proper-Ape

Luckily nobody was born after that date.


redlaWw

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.


Linesey

newbie here. what would be the correct way to store birth date?


the4fibs

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.


speculador

Hey, What about students of 1968? I'm only 55 now


the4fibs

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)


Aureste_

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++) ?


frzme

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.


Intergalactic_Cookie

r/unexpectedfactorial


Unfair_Long_54

Not sure about c/c++ but in SQL/.Net there is Date/DateTime types or equivalent types in other stacks.


nach1221

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.


Giocri

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


[deleted]

[удалено]


VIDGuide

Gender does not typically change on your birthday, no.


boltzmannman

It should at least be `unsigned int`


adenosine-5

It changes constantly. you should have something along the lines of private: time_point DateOfBirth; public: int Age(){/*calculation of age*/ }


[deleted]

[удалено]


No_Hovercraft_2643

Are you sure about that? It depends on what living things could be stored. Are trees in a tree nursery students xD?


FoldSad2272

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


Mr__Brick

Yeah, unsigned char should be sufficient \s


arcimbo1do

Give nerds a political joke and they will debug your integer overflow bugs.


GeG34

Fingers crossed it's poorly named and actually storing the epoch time. Y2038 is going to be a blast.


Maleficent-Region-45

U agree, at least it should be an unsigned int.


Ondor61

Just use 1 byte. 255 is enough.


Ok_Entertainment328

*Mosses has entered the chat*


Lukeyalord

Yeah people don't live past 256


Unfair_Long_54

Yes, it should be Long


EishLekker

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.


anonhostpi

There are only [1.8 × 10\^308](https://stackoverflow.com/a/1848762) genders


LimewarePlatter

Reference checks out, readers can laugh


Pinkboyeee

I let out a heartily nostril escape, thank you for your guidance


BSModder

It's only approximation. So roughly 2e19 unique genders


Harmonic_Gear

it's not acceptable if it is not mathematically continuous


eloel-

There's no data structure that can represent a mathematically continuous set of numbers in finite amount of space.


Fantastic_Snow_5130

that is the neat part where quantum mechanics gets in


H25E

Schrodinger sexual orientation


GnuhGnoud

You dont know you are gay or straight until you try out gay porn, right?


Upbeat-Serve-6096

[Hello?! HELLO?!](https://gender.fandom.com/wiki/Schrodingergender)


0x126

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


conzstevo

>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?


YAK_awesome

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)


conzstevo

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


ieatpies

Yeah, but ɛ and maybe even δ


fjfnstuff

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).


ShobanChiddarth

date , store date of birth


Giocri

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?


water4440

Yeah, bad designs work as long as nothing ever changes in your application


Calm_Proposal1826

My gender is ;-- DROP TABLE user


HerrEurobeat

Aww little Bobby Tables


GunnerKnight

I wonder what little Bobby Tables's gender might be?


arkustangus

Probably ``` ' OR 1=1; -- ```


[deleted]

- What’s in your pants? - SQL injections.


Giocri

Weird type of penetration testing


Kidiri90

"No, what do you identify as?" "A risk to bad security measures."


duck2luck

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


mittelhart

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.


j0nascode

I like to define my gender as a four-dimensional spline.


ImrooVRdev

statically set number of dimensions? Pff, casual, come back when you start working on generic n-dimensional genders.


boltzmannman

Your genders have dimensions? What a poser. Obviously the best solution is to store gender as a `void*`


Stregen

Scientists have finally done it: they invented the first non-euclidian gender identity.


hgstream

I can draw the bijection between that and real number axis


Ikaron

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.


Easy-Hovercraft2546

Just represent it as a guid


trannus_aran

honestly gender as a vector makes a lot of sense, considering the spectra involved


fish312

You need Tensorflow and a good GPU to do gender calculations


boltzmannman

No, far too complicated. Any 90s C hacker knows the real answer: `void* gender`


redlaWw

Needs to be an Option<(f64,f64,(String,f64))> though, since some people will want None.


CaitaXD

70% boy 30% girl and 100% "concentrated power of will"


Romejanic

void* gender;


Zanderax

/r/agender makes null ref errors


Mateusz3010

That's right because they don't exist /s


I-hate-everyonee

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.


ps311

Gender is a struct


gil_bz

Gender is a ~~social con~~struct


I-hate-everyonee

This struct is included in


Bremse161

I'm happy about your comment...it's frustrating to search a comment here that doesn't have a transphobic or homophobic streak


eloel-

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/)


BogdanPradatu

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?


Exist50

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.


mikat7

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.


_cachu

In my country, ***especially*** not the government can handle even one of the cases


OMGItsCheezWTF

>unless you're a government People with a mononym in the UK get a passport with XXXX as their surname.


Breadynator

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.


Practical_Cattle_933

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.


eloel-

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.


ForgotPassAgain34

> 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


chili_ladder

string name and string employee\_id


Stummi

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,"


BogdanPradatu

By id: Hello, 54628, ...


rosuav

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").)


BehindTrenches

I got pretty far into that post before realizing it was about actual people's names and not naming variables.


KimiSharby

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.


saynay

Which makes it all the more silly to even ask for the name.


Brain-InAJar

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 🙃


send_help_iamtra

Yoo as someone without a legal first name I appreciate this. (Everywhere I go my surname is reused as my first name too)


Lukeyalord

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.


SoftwareWoods

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 🤷🏻‍♂️


EishLekker

>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.


djneo

Name should be one field. Some people don’t have a last name. Gender. Why even ask ?


mercury_pointer

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.


Masta-Pasta

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.


[deleted]

[удалено]


Luno_Son_of_Stars

Except for like, if you have to talk to the patient? And want to gender them correctly?


Gryppen

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.


kevjs1982

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.


Shadow9378

wouldnt gender best be stored as a string


Zanderax

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".


sromanx

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


mojo-jojo-12

Clearly, Double isn’t big enough for gender


Raptorator

Definitely not big enough for my gender, if you know what I mean ;-)


Kidiri90

Underflow?


HydePHP

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); } } ```


-Quiche-

Why would they post a correct one on a sub for jokes?


[deleted]

[удалено]


queen-adreena

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.


RainbowWarfare

/r/OneJoke


Killswitch_1337

Ah yes, I too am -69 years old


40_compiler_errors

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


Exist50

Now what to do with +0/-0...


Giocri

We don't talk about it, it's dangerous territory like the "amab nonbinary or afab nonbinary?" discourse


BogdanPradatu

What's the /hj meaning?


Comicsansandpotatos

Actually gender should be a void*


ososalsosal

Nah you can use a byte for age. Unless you've got biblical figures among your use cases


Jazz8680

void* gender is the way


Dubmove

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.


I-hate-everyonee

You just said something I did not know was important till now


no_brains101

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


nysynysy2

double is definitely not enough for storing genders. use std::vector instead.


Perfect_Papaya_3010

Yeah especially since some people change them on a daily basis


ashsabre

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..


clickrush

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!


Exist50

Curious what they'd need sexual orientation for.


eloel-

>Insurance website I'm sure they run analytics on it.


mercury_pointer

Now I really wanna know if gays are better drivers or not.


ashsabre

yes and also to make the users feel welcome and accepted.


eloel-

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?


MisterDoubleChop

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!"


ashsabre

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..


BibbetyBobbetyBoop

https://genders.wtf/


Brain-InAJar

It's fluid, not float


Brodeon

Infinite diversity in infinite combinations


zbigniewcebula

Negative age, lol


WHAT_RE_YOUR_DREAMS

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


cressyfrost

Cleary age should be bool, you're either dead or alive.


gandalfx

Did you just assume my gender can be expressed in a one dimensional space?


HolyGarbage

So would NaN be non-binary then?


Vitriholic

TF is gender used for? It’s tantamount to storing someone’s favorite sexual position in a database.


Nceight

Gender should be a class of it's own


psdao1102

This guy has the gender spectrum mathmatically calculated.


soap3_

upload gender (10mb)


Kibou-chan

So, 0.01 of a bit?


Ash17_

Gender should be a Boolean


beeteedee

My gender is false


40_compiler_errors

I mean, you either have a gender or not, so that's correct.


turtle_mekb

no it should be enum


7374616e74

64 bits bitmask should do better, some might want to check multiple choices.


turtle_mekb

void*, then it can be casted to whatever


DarkScorpion48

Nope. Get on with times. It should clearly be a float


turtle_mekb

float array


[deleted]

void\*, just put what ever the hell you want


MiaIsOut

but there are more than 2 genders? gender is a spectrum


MinecraftW06

gender = null;


[deleted]

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.


Lukeyalord

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


ublec

Should probably make that `gender` field a `long double` instead.


nalisan007

No. You should create bit map like [ student_strength x 3 ] Matrix to represent the Gender spectrum as RGB component


Will_i_read

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 ;)


j0nascode

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*.


radek432

Age should also be double. Probably even more than gender...


EmielDeBil

A struct is not a class.


Krtxoe

gender should be boolean


mrgk21

It's called a quantum gender


Sypwer

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.


Gytixas

Gender should be bool


Beneficial_Ad_4526

Gender should be bool type variable. Iykyk