3 ms·
People nearly always gravitate towards abbreviations in natural language. The more a word is used, the more likely it gets shortened. LA for Los Angeles, Frisco
by WalterBright 4y ago
People nearly always gravitate towards abbreviations in natural language. The more a word is used, the more likely it gets shortened. LA for Los Angeles, Frisco for San Francisco, Vicki for Victoria, Jay for Jason, Dub for George W Bush, Doozy for Duesenberg, and on and on. Why should programming be different?
- SmooL 4y agoBecause abbreviations are nice when there's a shared context that is perpetually "in memory" - I don't have to think to know what LA stands for. However, that is not the case when debugging. It is almost certainly the case for the person who wrote the code originally, but it is certainly not the case for the next person to come read it afterwards. IMO code is meant to be read, so I try to never use abbreviations (other than e.g. _i_ as a for loop index, which, given it's pervasive use, falls under the category of "shared context").
- ReactiveJelly 4y agoI read somewhere, "The length of a variable name should be proportional to the size of its scope". Usually I don't have long loop bodies, so if the loop body fits in 24 lines, `i` is perfect for the index. If I'm locking a mutex, doing something, and quickly unlocking it, `l` for the lock guard is fine. But if it won't fit on screen, it needs a longer name. And if there's something like a top-level `App` struct, I just call it `a` because its scope is really just `main`, even though its _lifetime_ may be the entire process.
- camgunz 4y agoShouldn't you have some shared context when working on code together, even at different times? Maybe they terms of art, maybe it's a style guide, but there oughta be something. Like, isn't it fine to change: var basicAuthenticationController = new BasicAuthenticationController() to: var ctrl = new BasicAuthenticationController() I find that if code authors do work upfront to contextualize things for me that it helps tremendously. Like do I need to know at every point that this is a BasicAuthenticationController? Or is this the basic auth module and we're always dealing w that controller? I prefer it when engineers set the table for me like that, it helps me narrow my focus to the purpose of the code.
- baby 4y ago> Frisco for San Francisco wait what. I live in SF and everybody just says SF
- WalterBright 4y agoI've heard SF, SanFran, Frisco, and Cisco.
- MajorBee 4y agoKinda going off on a tangent here, but it was a mild "ohhh" moment for me when I first realized that the company Cisco is actually named after San Francisco, followed by a second such moment when I realized that Cisco's logo represents the Golden Gate bridge.
- baby 4y agointeresting, I'm used to outsiders saying "sanfran" but never heard frisco and cisco
- WalterBright 4y agoCisco Systems https://thebolditalic.com/don-t-call-it-frisco-the-history-of-san-francisco-s-nicknames-the-bold-italic-san-francisco-5c14348d49c https://thebolditalic.com/don-t-call-it-frisco-the-history-o...
- dhosek 4y agoAbbreviations that are widely understood are fine. sql_string is superior to standard_query_language_string. On the other hand, I would prefer customer_id to cid in most cases.
- enasterosophes 4y agoWhen I worked as an analyst in DoD, it was widely understood that acronyms would appear everywhere in everything we did, but also that it can confound a reader who bumps into an unfamiliar acronym if it appears out of nowhere in a report. The caution and best practice was to always give the full name the first time it is used, together with its acronym in parentheses. Then after that you are free to use the acronym as much as you want. I doubt it would be controversial if programmers adopted a similar convention.