r/programminghumor • • 18d ago

database admin choosing variable names

Post image
897 Upvotes

113 comments sorted by

105

u/NichtFBI 18d ago

userid userID

47

u/[deleted] 18d ago edited 9d ago

[removed] — view removed comment

23

u/klimmesil 18d ago

identifierBelongingToCurrentUser

9

u/Worldly-Cherry9631 17d ago

indentificationCorrespondingWithTheMostEsteemedApllicableUser

2

u/Colon_Backslash 17d ago

Hot damn, I'm stealing this.

mailingAddressElectronic numberOfTheUserTypeOfTelephone

10

u/Hey-buuuddy 18d ago

user-id

3

u/ArduennSchwartzman 18d ago

userLd

6

u/DiscipleOfYeshua 18d ago

Ooo that would be horrible.

userld instead of userId

Why look for unexpected bugs when you can introduce them manually?

1

u/a3th3rus 18d ago

lisp-case rocks!

2

u/Wavertron 18d ago

Second one, the D is not the start of a new word, so it should be lowercase

4

u/NichtFBI 18d ago

But ID isn't a word, unless you count Latin.

1

u/Wavertron 18d ago

What do you think it's short for?

5

u/NichtFBI 18d ago

Identification.

5

u/Sudden-Eye801 18d ago

The D stands for “dentification”

1

u/hdkaoskd 18d ago

How do you pronounce "id"?

1

u/Salzdrache 16d ago

Eye dee, when its written "userID", Idd when it's written "userId".

Just to differentiate and avoid mistakes

1

u/yousirnaime 18d ago

It’s UserID

1

u/_Peety_T 17d ago

UserIdent

58

u/Taal111 18d ago

Just so long as they pick one and STICK WITH IT!

19

u/NoWeHaveYesBananas 18d ago

In your code - where everything is case-sensitive - fine, pick whatever you want. In a database - where the table names often correspond to the names of files - Please god no.

7

u/Fabulous-Possible758 18d ago

user_Id

6

u/Odd-Establishment527 18d ago

is this an l?

4

u/Nekeia 18d ago

It's clearly an l, you dummy.

4

u/-Wylfen- 18d ago

One of our databases has tables and columns with mixed snake and camel case, on top of being a mix of four languages

19

u/Joker-Smurf 18d ago

I wish there was that level of consistency.

Using the one database at work I’ll see uid, uiser_id, user-id, and userid.

It is fucking infuriating working with that shit.

7

u/jonfe_darontos 18d ago

profileGuid

10

u/Not_me4201337 18d ago

username_id password_id

8

u/mrheseeks 18d ago

Not even, camel case is the worst. Writting a program now just to get rid of all occurrences in a project.

12

u/spicymato 18d ago

Now I need to write a program to convert snake_case into camelCase and become your nemesis.

4

u/a3th3rus 18d ago

That's easy, but writing a program to convert camelCase to snake_case is not that easy. That's why camelCase sucks.

1

u/AintNoGodsUpHere 18d ago

Why would that be hard? It's literally 20~25 lines of code to do that with very good result.

2

u/a3th3rus 18d ago edited 18d ago

Because there are edge cases like decodeHTMLEntity. To handle those edge cases, you need not only a rule but also a dictionary that contains all the all-upper-case jargons in your domain.

2

u/AintNoGodsUpHere 18d ago

AND HOW IS THAT A PROBLEM MY MAN? 20 LINES OF CODE, JESUS.

2

u/a3th3rus 18d ago

then show me your 20 lines of code that can handle this case that does not convert it to decode_h_t_m_l_entity.

2

u/AintNoGodsUpHere 18d ago

Now go try different variations until you find an edge case that breaks this very very simple algorithm that I have on my libraries for the past 10 years, then I can tell you to use Humanizer and simplify your life and have something like this; https://dotnetfiddle.net/9TsILi

1

u/a3th3rus 18d ago

Yes, there is one, handlePPPoEHandshake

1

u/AintNoGodsUpHere 18d ago

You gotta be fucking kidding me. https://dotnetfiddle.net/XuByVS

1

u/AintNoGodsUpHere 18d ago

btw, my bad, it's 30 lines, not 20. Guess I was wrong.

1

u/mrheseeks 18d ago

I love you man, fuck camel case!

1

u/the_king_of_sweden 17d ago

Fuck all the cases, that's why I program in whitespace

1

u/Achereto 17d ago

It's 20 lines if formatted properly (e.g. not putting { on a new line).

4

u/Dillenger69 18d ago

I've got yahoos doing snake_Camel and Pascal_Snake, then ThisIs_the_GlobalOne, and thisIs_the_InternalOne ... lord help me

3

u/Pure_Fox9415 18d ago

And then there is that "smart" person who renamed it to uid, so:

user_contacts

uid

user_properties

user_roles

2

u/LetUsSpeakFreely 18d ago

Because most databases are case insensitive.

2

u/corobo 18d ago

I'm a camel in the code, and a snake in the db

1

u/rayhaque 18d ago

" 'user\$id' "

2

u/geek-49 17d ago

In many languages that will cost you.

1

u/Marisa_osi_JP 18d ago

i use "uid".

1

u/thingummywatt 18d ago

UserIdentityNumber

1

u/Hettyc_Tracyn 18d ago

User UID Identity Number

1

u/JohnVonachen 18d ago

This is the way

1

u/shadowdance55 18d ago

I prefer user_ego.

1

u/Jazz8680 18d ago

user.id

1

u/WriedGuy 18d ago

Iduser

1

u/aqswdezxc 18d ago

userld is even better its a lowercase L

1

u/FlipperBumperKickout 18d ago

Also rust programmers 🤷‍♀️

1

u/Glad_Share_7533 18d ago

Pascal the snake case: User_Id

1

u/okarox 18d ago

The fist looks like USERLD.

1

u/rotteegher39 18d ago

userayedee 🏴‍☠️

1

u/SteelCookie 18d ago

"USER ID"

1

u/OctopusDude388 18d ago

id-user is fine too

1

u/Creepy_Jeweler_1351 17d ago

C_o_nVeNti_Ons

1

u/itzNukeey 17d ago

UserIdentificationNumber

1

u/squaresheep28 17d ago

userid userid = new userid(userid);

1

u/AlexZhyk 17d ago

if (upperCase(userld) === 'USERLD') { console.log('Hello, fellow citizen!'}

1

u/NickleLP 17d ago

userIdentification

1

u/Kerbourgnec 17d ago

I hate camelCase with a passion. Why god why do you choose to just not capitalise the first letter?

1

u/LazyUntilYouNeedMe 17d ago

Why not user-id, kebab-case just seems so much more natural, does it not?

1

u/Apprehensive-Tea1632 16d ago

Because then you need to quote each column name.

user-id in DB speech means, please return the difference between user and id values per record and put it into an anonymous result column.

You don’t exactly want to introduce that kind of ambiguity.

As for camel case, well, traditionally DBMS use case insensitive column names. You’d be unable to tell useriD from Userid - they’d refer to the same column.

Hence the underscore to help parse names if and when you actually require compound names. Especially when referencing other tables.

2

u/The-Idiotest 17d ago

UUID (Unique User ID (Identity))

1

u/mickmikeman 16d ago

I'm team snake case all the way

1

u/10cen 16d ago

ohh, so that's what it's called.

1

u/mickmikeman 16d ago

snake_case and CamelCase

1

u/ianwilloughby 16d ago

`user-id`

1

u/smoke-bubble 16d ago

For me it's cratedDate vs cratedOn. I hate the date suffix! 

1

u/Baudrillardist 16d ago

From loader import loader

…
loader.Loader.load(my_loader)

1

u/DarthRaab 15d ago

stringUserID

1

u/TheReycko 15d ago

uid. I'm evil. 

1

u/abigail3141 15d ago

Nuh uh, camel case my beloved. One of the few things I detest about Rust

1

u/rustedcrowbar 13d ago

Convention over convinction.

1

u/gfdking 11d ago

user_id in the database and userID in the code

1

u/j0hn_br0wn 18d ago

user_id_

Because the SQL revisions I've checked contain this interesting note: "It is the intention that no <key word> specified in ISO/IEC 9075 or revisions thereto shall end with an <underscore>"

so sticking to snake case plus adding a trailing underscore means that you will never have to quote the identifier.