Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
@alexbrooklyn It's where I store the widgets that they can add ... but varchar is limited to 255 characters, I kinda forgot about that.
-
@alexbrooklyn widget names in this case. Even ids wouldn't save a lot of space as the "names" are pretty short / nonsensical.
-
@N00bPancakes I would've probably gone with a widget tables and a ma y-to-many table for users and widgets.
But I'm sure that approach has more disadvantages compared to the textfield -
Root825994yI’d also use a many:many relation.
Space is cheap, especially for a table with three int columns! 😂
Depending on implementation that’s 12 bytes (plus db overhead) per row/widget. Fair, the join would take a few more ms, but that’s really just moving the load from your app (string splitting) to the database, which is probably faster anyway. -
@IntrusionCM I was trying to not be too judgemental or without context for once
If I had to review it tho, I'd have killed the guy and forced the many-to-many approach -
It's an denormalization...
And one of the most dangerous.
Storing multiple references in one field in a referential database leads to all kinds of fuckity - since now the handling of uniqueness, data integrity and so in lies on the application side.
I've had to migrate similar problems and it usually ended with writing a parsing program...
In the worst case, I had to play whack a mole and generate an XLS which some very unlucky coworkers had to double check manually - since the reference in the varchar was sometimes cut off, sometimes duplicated, sometimes pointing to null....
Fun. Not. -
To be clear the widget names are the primary key / ID of something else in the DB.
I was being very vague as the story wasn't intending to go through the whole process here ;)
I call them widget names because that is the end result for the user... -
Root825994yCome on, everyone! Let’s not all roast him over something he admitted was bad! That’s just mean.
-
@Root Thank you.
I don't want to get into mega corp 5000's choices are bad / how they came to such decisions.
Sometimes you work within the system before you can change how they do things.
Also you pick longer fields....
We complain a lot about others. I'll toss out my own dork up from today.
Customer: "Can we add more than X widgets? There seems to be a limit."
Me: "Wut? Lol no I didn't limit.... wait a second."
SQL... field type... varchar
-hand to forehead-
random
varchar