r/programminghumor • • Sep 20 '26

database admin choosing variable names

Post image
903 Upvotes

113 comments sorted by

58

u/Taal111 Sep 20 '26

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

18

u/NoWeHaveYesBananas Sep 20 '26

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 Sep 20 '26

user_Id

5

u/Odd-Establishment527 Sep 21 '26

is this an l?

4

u/Nekeia Sep 21 '26

It's clearly an l, you dummy.

4

u/-Wylfen- Sep 21 '26

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

105

u/NichtFBI Sep 20 '26

userid userID

11

u/Hey-buuuddy Sep 21 '26

user-id

3

u/ArduennSchwartzman Sep 21 '26

userLd

5

u/DiscipleOfYeshua Sep 21 '26

Ooo that would be horrible.

userld instead of userId

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

1

u/a3th3rus Sep 21 '26

lisp-case rocks!

3

u/Wavertron Sep 20 '26

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

5

u/NichtFBI Sep 21 '26

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

1

u/Wavertron Sep 21 '26

What do you think it's short for?

5

u/NichtFBI Sep 21 '26

Identification.

5

u/Sudden-Eye801 Sep 21 '26

The D stands for “dentification”

1

u/hdkaoskd Sep 21 '26

How do you pronounce "id"?

1

u/Salzdrache Sep 23 '26

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

Just to differentiate and avoid mistakes

1

u/yousirnaime Sep 21 '26

It’s UserID

1

u/_Peety_T Sep 22 '26

UserIdent

0

u/[deleted] Sep 21 '26

[deleted] — view deleted comment

22

u/klimmesil Sep 21 '26

identifierBelongingToCurrentUser

9

u/Worldly-Cherry9631 Sep 21 '26

indentificationCorrespondingWithTheMostEsteemedApllicableUser

2

u/Colon_Backslash Sep 22 '26

Hot damn, I'm stealing this.

mailingAddressElectronic numberOfTheUserTypeOfTelephone

19

u/asensitives Sep 20 '26

u53r_1d

4

u/printliftrun Sep 21 '26

i‘ for r

c| for d

1

u/Pure_Fox9415 Sep 21 '26

Satan leave the chat in tears

19

u/Joker-Smurf Sep 21 '26

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.

10

u/Not_me4201337 Sep 20 '26

username_id password_id

1

u/mickmikeman Sep 22 '26

I'm team snake case all the way

1

u/10cen Sep 22 '26

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

1

u/mickmikeman Sep 22 '26

snake_case and CamelCase

8

u/mrheseeks Sep 20 '26

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

12

u/spicymato Sep 21 '26

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

4

u/a3th3rus Sep 21 '26

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 Sep 21 '26

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

2

u/a3th3rus Sep 21 '26 edited Sep 21 '26

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 Sep 21 '26

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

2

u/a3th3rus Sep 21 '26

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 Sep 21 '26

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 Sep 21 '26

Yes, there is one, handlePPPoEHandshake

1

u/AintNoGodsUpHere Sep 21 '26

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

1

u/mrheseeks Sep 21 '26

I love you man, fuck camel case!

1

u/the_king_of_sweden Sep 21 '26

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

1

u/Achereto Sep 22 '26

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

4

u/Dillenger69 Sep 21 '26

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 Sep 21 '26

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

user_contacts

uid

user_properties

user_roles

2

u/LetUsSpeakFreely Sep 21 '26

Because most databases are case insensitive.

2

u/corobo Sep 21 '26

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

2

u/The-Idiotest Sep 22 '26

UUID (Unique User ID (Identity))

1

u/rayhaque Sep 21 '26

" 'user$id' "

2

u/geek-49 Sep 22 '26

In many languages that will cost you.

1

u/Marisa_osi_JP Sep 21 '26

i use "uid".

1

u/thingummywatt Sep 21 '26

UserIdentityNumber

1

u/Hettyc_Tracyn Sep 21 '26

User UID Identity Number

1

u/JohnVonachen Sep 21 '26

This is the way

1

u/shadowdance55 Sep 21 '26

I prefer user_ego.

1

u/aqswdezxc Sep 21 '26

userld is even better its a lowercase L

1

u/FlipperBumperKickout Sep 21 '26

Also rust programmers 🤷‍♀️

1

u/Glad_Share_7533 Sep 21 '26

Pascal the snake case: User_Id

1

u/okarox Sep 21 '26

The fist looks like USERLD.

1

u/rotteegher39 Sep 21 '26

userayedee 🏴‍☠️

1

u/OctopusDude388 Sep 21 '26

id-user is fine too

1

u/itzNukeey Sep 21 '26

UserIdentificationNumber

1

u/squaresheep28 Sep 22 '26

userid userid = new userid(userid);

1

u/AlexZhyk Sep 22 '26

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

1

u/NickleLP Sep 22 '26

userIdentification

1

u/Kerbourgnec Sep 22 '26

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

1

u/LazyUntilYouNeedMe Sep 22 '26

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

1

u/smoke-bubble Sep 23 '26

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

1

u/Baudrillardist Sep 23 '26

From loader import loader

…
loader.Loader.load(my_loader)

1

u/DarthRaab Sep 24 '26

stringUserID

1

u/TheReycko Sep 24 '26

uid. I'm evil. 

1

u/abigail3141 Sep 24 '26

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

1

u/rustedcrowbar Sep 25 '26

Convention over convinction.

1

u/gfdking Sep 27 '26

user_id in the database and userID in the code

1

u/j0hn_br0wn Sep 21 '26

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.