@lig Just echoing similar sentiments here, I would go with 'object_id' as I personally find camelCase to be horrifyingly unreadable.
@lig I hear you. If you're coding as part of a team/org then naming conventions are forced upon you.
In that case, might I suggest going for a more structured approach.
If the second word has less than three letters then capitalize it, otherwise use camel case.
E.g. objectID, objectRef, objectName, targetDB, targetArr, targetArray, etc.
Hope that helps. 👍
@oedmarap So, you mean acronyms should be always capitalized. Ok. Then the question is: Is `ID` an acronym or a shortened abbreviation?
@lig Well to my point, ID isn't a proper noun (acronym), so it falls back on the character-limited rule without any further context.
@oedmarap I don't see the point in character limit here then. Consider those: thingsToDo, doWell, amountUSD, userId, currentDate, currentTS.
@oedmarap And another one. `airportIATA`. Should `airportIATA` be `airportIata` then? I like `airportIATA` better.
@lig Nothing. Proper nouns should always be all caps if they're an acronym, e.g. UN, UNICEF, IATA, NYC, GCP, AWS, etc.
@oedmarap That's it. See, my original question was about `ID` specifically. It is "ID" when it's standalone and "objectId" as it isn't an actual acronym 🤷
@lig I think you misunderstand what I'm trying to say.
The baseline rule is the character number. This is the default. ID fits here when it's the second term after 'object' simply because it's <3 chars.
The proper-noun supersedes the above rule (on occasion). IATA fits here after 'airport' for example.
Edge case will happen but the above should cover ~90% of naming situations (and that's the goal, really).
@oedmarap I don't get it. What changes at 3 characters? Are you suggesting `objectID`, `whereIS`, and `shouldGO`?
@lig Exactly, yep. Given the ratio of sensible two letter words vs. two letter acronyms (there are more of the latter than of the former) this shouldn't be a problem.
@oedmarap It doesn't make sense to me. Sorry.
I'd say just capitalize the first letter and keep acronyms always capitalized.
Going back to my original question, the answer is `objectId`, because `id` is just shortened variant of `identifier`. And that's it.
@lig Exactly the reason I don't use camel case. 🙂
But I'm just suggesting adding _some_ type of sanity checks into the naming schemes. Edge cases will happen but not very often.
Fosstodon is an English speaking Mastodon instance that is open to anyone who is interested in technology; particularly free & open source software.