Live data from Hacker News

A made-up name is better than no name

mbuffett.com

61–70 of 86 posts

Re: A made-up name is better than no name

#61

> A Made-up Name is Better Than No Name Perhaps, but a meaningful name is better than an arbitrary made-up name.

> a meaningful name is better than an arbitrary made-up name.

What's the difference? All names are ultimately arbitrary and made-up. For what it is worth, my best at attempt at interpreting this is that a meaningful name is an arbitrary, made-up name that also comes with a reasonably precise definition. In which case, the idea of choosing a meaningful name is the intent of the article.

Re: A made-up name is better than no name

#64

Earlier quoted context omitted.

That's definitely a possible failure mode, but I think it's preferable to having DataProcessingWorker, IngestService, ProcessingService, DataLoader, etc. Because, you eventually end up with all of these names and it's just as hard to guess what happens where as if they were named after fruits. At least for me having too many names that are nearly semantically identical is worse than names that are a little (or even a…

I’m also in agreement with this. Give me unique and memorable over generic-looking-with-the-merest-bit-of-information. Used to work at a place where every repo, every service, etc was all CompanyShortNameThingDoerServiceRequester and similar, surprisingly unhelpful. I don’t want the 100th CompanyDataIngesterService because they all blur into one. At least if someone goes “oh yeah the Oyster service will give that to…

In my personal experience, libraries/code that is widely applicable is what benefits from having a great weird fun name. No one wants to deal with a one off service you decided to name Hecate with no reason or broader appeal.

Re: A made-up name is better than no name

#65
This didn't sit quite right with me and I think I've pinned down why.

The nature of code is that it is communication: it communicates action to the computer and behavior to the reader. Variable names are not for the computer, they are for the reader, so, whenever possible, the names we use should be meaningful to the reader.

If the name requires specialized knowledge, such as "what does this name mean," it is lingo, which is sometimes necessary, but should be regarded as a smell, as it is often better to use language which does not require specialized knowledge, so that the reader will be able to make sense of it without a thesaurus.

According to the concept Domain-Driven Design, we should be using names from the domain itself in the program. So what could be the proper name here?

Well, EPD is short for Extended Position Description, which is a notation for representing a particular board state. SAN is short for Standard Algebraic Notation, which is used to encode a particular move.

So an EPD SAN is a particular board position when a particular move is applied to it. I propose to call the combination a "play" which is the act of moving from a particular board position. The code would then be:

  let difficulty_by_play = //...;
  let existing_plays = //...;
  let unique_moves_by_play = //...;
  fn play_to_condition((epd, san_plus): &Play) -> _ //...;
The result is legible, the concept is meaningful, and a naive reader could make sense of the variables and operations. No cognitive / conceptual overhead.

Cleaner code, I would claim.

https://en.wikipedia.org/wiki/Domain-driven_design https://en.wikipedia.org/wiki/Extended_Position_Description http://www.saremba.de/chessgml/standards/pgn/pgn-complete.ht...

Re: A made-up name is better than no name

#66
post #65

This didn't sit quite right with me and I think I've pinned down why. The nature of code is that it is communication: it communicates action to the computer and behavior to the reader. Variable names are not for the computer, they are for the reader, so, whenever possible, the names we use should be meaningful to the reader. If the name requires specialized knowledge, such as "what does this name mean," it is lingo,…

The more abstract and technical the subject matter the less likely that it will mirror a familiar real world experience and have a good word.

Using a real world name can actually be distracting because it may suggest attributes and behaviors which are not true of the thing.

This is why math papers use Greek letters. There is no words for “the amount of space where if the function is close enough than the cube of that function value will be within the initial tolerance requiring” so they just use “delta” and you learn the exact meaning of delta from its definition and usage.

I think this advice about “readable code” comes from every day business problems where there is a close correspondence between code processes and business processes.

Complex programs require expertise to understand, and only hubris would make you think longer names would substitute for studying the subject. Even “string” is technical jargon.

Re: A made-up name is better than no name

#67

Earlier quoted context omitted.

Those are abbreviations, not acronyms.

They are acronyms. Why do you think differently? And acronyms are abbreviations. If you want to argue more you could state they’re initialisms, but SAN is standard algebraic notation so it’s definitely an acronym, while EPD could be argued not, but instead to be an initialism. In any case Wikipedia says it’s not a settled matter so why even argue about it? https://en.m.wikipedia.org/wiki/Acronym

I’m not OP, but I’ll answer the question for me. I think differently because I was taught differently in English class about 40 years ago. The wikipedia page makes a weak argument.

What do you think distinguishes an acronym from other abbreviations?

Re: A made-up name is better than no name

#68
post #35

Disagree, especially using that first name pops into your mind. Obviously, if it needs a name or would greatly benefit from a name, give it a name. But have it at least somewhat descriptive. EPDSan, Sanepd, ESpair or some other variation is a lot better then "the first thing that comes to mind".

No one knows what San, EPD, EPDSan, Sanepd, Kep, etc, are. No matter what the word, you have to learn it, and it's a small one time cost, and you're done. The additional cognitive load to learn a made up term is negligible.

Re: A made-up name is better than no name

#69

If it occurs often enough, yes! The human brain finds unexpected or weird words a lot more memorable than expected words. grep is better than find "find-regular-expression" awk is better than "execute-command-on-regular-expression" perl has nothing to do with pearls If it's a common command, concept, function, etc. that appears in may places, give it an odd name! Document it thoroughly! And don't go overboard. When e…

> grep is better than find "find-regular-expression" I'm not sure if you are familiar with where grep came from, but in short it is an abbreviation of a command in the original UNIX text editor: g/re/p - g for global command, re standing for your search query and p for print to screen or teletype. In that way, it is nothing more than an anachronism that would have been immediately obvious to anyone working in a UNIX…

Choosing the name grep because it is easily recognizable as coming from the command it is inspired by is literally "intentionally designed to be memorable".

Re: A made-up name is better than no name

#70
post #57
post #44

Earlier quoted context omitted.

I prefer code names over acronyms. Like code names, acronyms are meaningless to the uninitiated, but for me code names are more memorable. Here, I don't know what "EPD" or "SAN" mean and these are terms I have to get familiar with when reading the code base, just like "kep". I get that EPD and SAN are probably familiar terms to chess people, but the idea there is never a code base where you don't have to get familar…

I have found Android codenames to be a nightmare. Docs will sometimes refer to a codename, a version, or an SDK level. Why do we need three pointers to the same thing?

Ubuntu is the same, unless you happen to know the previous release and know they are in alphabetical order. Debian is even worse: not in order, no one ever uses the version number.
Post reply on HN