7 ms·
A made-up name is better than no name
- mouse_ 2y agoThis works great if you're absolutely certain no other poor sap is going to have to work with your code. I do this myself for personal scripts! Otherwise, please prioritize readability.
- brudgers 2y agoDocumentation is probably better than readability because readability makes a lot of assumptions arising from being close to the code...for example, Swedish names are not gonna be all that readable for most programmers (this holds true for English names as well).
- marcusbuffett 2y agoIt’s one made-up name in a 30,000 line codebase. I think if anyone else ever works with the project they’ll have a lot harder things to catch up on than this convention
- p1necone 2y agoI think needing to work out what it is by asking someone or reading documentation or whatever is a feature, not a bug here. If you instead used a word that kinda described what it is without being able to explain specifics people might make assumptions. If they have to go "what the hell is a kep" and then ask you then you can be sure they'll find out about the implementation that's slightly different from other keps, or the weird bug that happens when you do y, or the handy library for doing kep things or whatever before they waste time going down the wrong path. Obviously this sort of thing should be done sparingly, otherwise you end up with a completely incomprehensible codebase - but for specific things are are genuinely novel I think it could help with overall grokability rather than hinder it.
- Terr_ 2y agoA made-up name is fine if (A) your code is private and (B) fixing it later is easy.
- cxr 2y agoThis is good if you're good at coming up with names that are good, even if they're inscrutable. If you're not so good at it, or do too much of it, then you end up getting a situation like the Urbit ecosystem.
- throwuxiytayq 2y agoCuts both ways - often it's useful to do the opposite and inline the type to avoid declarations that make you jump around. Especially in the case of small, one-off, tuple-like structures. But I'd keep the Kep.
- efitz 2y agoI really don’t like this idea if you are sharing this code base with anyone else. I work in one of the magnificent seven and the culture here is codename crazy. Everything has code names, of course: every project, every release of every project, every component or subservice of every project, every internal tool, and often minor features that address some one-off problem in any of the above. I am sure that these names solve some kind of brevity problem for the people on those immediate teams, but it is a nightmare for everyone else. It is impossible to reason about or even understand have the statements made by members of other teams in a meeting or communication because every other word they use is a code name for something that you’ve never heard of and the name doesn’t bear any resemblance to what it represents. It drives complexity through the roof.
- marcusbuffett 2y agoOh god yeah I’ve been in this situation too. Working at Apple it was like “is everyone in this meeting cleared for Tigris?” And you’d be like “I don’t know, what the hell is Tigris”, and then it turns out after you check your clearances it’s just iOS 13, which is obviously no mystery that after 12 there will be a 13. Just call it that! Nothing was named according to what it did either, I think our deploy tool was Carnival? Just codenames everywhere
- euoia 2y agoIn general I completely agree that code name overload is dreadful. But I think in this case, where this pair is so fundamental and used so frequently in the codebase, I think I would probably permit it. Beware codename creep.
- boredtofears 2y agoI dunno carnival seems like an apt name for a deploy tool at some of my past jobs.
- tshaddox 2y agoIt depends whether the increased brevity is worth the decreased intuitiveness. Consider that all words and names are made up in order to trade intuitiveness for brevity.
- serbuvlad 2y agoIf 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 everything is special, nothing is, with the added disadvantage that nothing is "readable" either.
- Sweepi 2y agoI regularly cannot remember if its "grep" or "greb". Never had this issue with Windows' "findstr".
- ketralnis 2y agoI have a lot of conversations like "There's a technique called 'secure computation', which confusingly is not just computation that is secure", "They're building affordable housing, which confusingly is not housing that is affordable", "I was on a cross-country flight, which confusingly is not a flight that crosses the country". Using a different word entirely can avoid that problem
- seabass-labrax 2y agoThe UK government defines 'affordable housing' as that which is available for at least 20% below the local market rate. Cross-country flights, at least where I'm from, do indeed cross the country on one axis or very nearly so. Is it not just the computer world which is the odd one out in coming up with needlessly confusing names?
- ghjfrdghibt 2y agoI often remove the vowels, so I'd have probably gone with 'pdSn' as the shorthand for it.
- einpoklum 2y agonc... m sr ts rl fn t rd r cd, mn!
- seabass-labrax 2y ago> Nice... I'm sure it's real(ly) fun to read our/your code, man! How did I do?! :D
- einpoklum 2y ago"real fun" and "your code"; 'y' is... well, vowel-ish at least. Otherwise let's say it was "ur code" in leet-speak.
- wruza 2y agoOh, I really love not reading code like that!
- Daneel_ 2y agoNot my preference, even for personal projects. How many times have you come back to an old project and thought “what the heck is this?”. I know it’s a lot for me. Over the years I’ve learnt to prioritise readability and to never abbreviate. Tab completion makes it a non-issue.
- deathanatos 2y ago… a company I once worked at named everything after characters from a certain TV show. Effectively the same as a made up name. Let's just say one of the character's name was … a tough one to pronounce. And it caused endless "what's a … Kep?" type questions. The CTO at some point later on decreed "enough; descriptive names, not made up things" … and the experience was such that I agreed with the decree, and I've sort of felt that way ever since. I've given a few names sparingly to a few things, but mostly a.) they have some connection to the named thing and b.) I reach for it when the purpose isn't clear yet and thus "descriptive" can be hard to come by. You could have named it a "PoMo" (portmanteau of position-move), if you're tired of typing. I'm also a bit surprised since the examples are Rust? Some of the naming is sort of "Hungarian notation"-esque. Why not let the type carry that information, and strike it from the name?
- kstrauser 2y agoThat's why my servers tend to have boring names like "web-23" now. Given them fun names is fun, up until it isn't, and then it's really freaking annoying.
- einpoklum 2y ago> A Made-up Name is Better Than No Name Perhaps, but a meaningful name is better than an arbitrary made-up name.
- tshaddox 2y agoNot always, for example when the meaningful name is much longer.
- deleted 2y ago[deleted]
- 9rx 2y ago> 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.
- einpoklum 2y ago> All names are ultimately arbitrary and made-up. You could say that all of human experience is arbitrary and all ideas are made up... The difference between arbitrary and non-arbitrary in this respect is whether someone who speaks the language and has a general relevant technical background would understand what the name means, in principle, or not. If the developer makes up something arbitrary themselves, then they would understand it, and so would one or two people who review the code or interact with it. Anyone else coming onto the scene would _not_ understand what that's about. You would end up with a glossary of bespoke terms not known to anybody else in the world. Now just think what were to happen if each repository of code had its own glossary of this kind. (shivers)
- 9rx 2y ago> whether someone who speaks the language and has a general relevant technical background would understand what the name means You are meaning in the case where there is already a well-known name for what is being described? That is reasonable, but in the article there is no pre-existing term known among those with relevant technical background for what is being described. A new name was warranted. Words have to start somewhere. All the words we know began life arbitrary and made-up.
- fundad 2y agoI like this and seeing Kep reminds me of kip, a currency, and that got me thinking that currency names is a fun source of "made-up" names for things.
- david-gpu 2y agoI once worked for a company that decided to eliminate internal codenames and instead use the actual brand names used by our customers. It removed a barrier to communication with no undesirable side effects. Thank you Tim! You did us a solid.
- not2b 2y agoSure, a made-up name is better than no name, but a mnemonic, logical, understandable name is far preferable. Perhaps just more thought is needed.
- aragonite 2y agoInstead of "kep", if you want something that visually stands out, there are also lots of fun little symbol-like characters you can use, even when you're dealing with a language where identifiers are limited to ID_Start/ID_Continue (e.g. Javascript, Rust). My favorite collection :) ⴵ ⵛ ꘜ ⵣ ꕤ ꖜ ꘖ ꧮ ⴲ Ⰴ Ⰺ
- kaptain 2y agoBut how do you discuss code issues verbally with others?
- aragonite 2y agoIf you must pronounce them, all the characters I listed are, in fact, pronounceable (as you can verify by googling them & visiting their Wikitionary pages) since they aren't actually symbols but letters from the alphabets of different languages. :)
- Etheryte 2y ago"Hey man, I pulled the latest changes and I'm getting sideways Lego brick is undefined, followed by cannot read properties of undefined when reading squiggly prongs."
- deleted 2y ago[deleted]
- wbl 2y agoNo multicoocular O? And try Luwian for a real kick: the cutest script.
- sph 2y agoBe nꙮt afraid. https://en.m.wikipedia.org/wiki/Cyrillic_O_variants https://en.m.wikipedia.org/wiki/Cyrillic_O_variants
- hakuseki 2y agoThe article is about (position, move) pairs. Why not call these objects "steps"?
- marcusbuffett 2y agoYeah this is a good shot at using existing verbiage, better than the candidates I came up with at least. Still not entirely self-descriptive, and has some overlap with usage in other parts of the codebase, like in data processing and user onboarding, but maybe that's a fine trade-off to make in order to use a normal word. I'd be equally fine with them being called "steps", but now I'm attached to my Keps :D
- deskr 2y agoDisagree, 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".
- stevebmark 2y agoNo 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.
- johnea 2y agoAren't all names "made up"?
- lgas 2y agoAll words are made up. - Thor
- beastcoast 2y agoI’ve been on teams that did generic names, and inevitably you end up with names like “work manager service” - whose work? Then it becomes an acronym, like WPS, and everyone ignores it anyways :)
- wruza 2y agowasn’t a mouthful like MoveFromPosition PosMove, but nothing wrong with MoveFromPosition either. I also easily get annoyed by mouthful typing, so I usually do the following: write code in short identifiers and then rename them after I finish. I wish dev envs could store two representations for an identifier, one short and one long, so one could easily switch between these (and also local/personal ones, or name comments at least). But that’s rocket science for text-based sources.
- SPBS 2y agoThis is awful. The alternative isn't "no name", it's a full and unambiguous name (even if it's a mouthful). If you can't come up with a good short name, stick with the long one.
- Empact 2y agoThis 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/Domain-driven_design https://en.wikipedia.org/wiki/Extended_Position_Description https://en.wikipedia.org/wiki/Extended_Position_Description http://www.saremba.de/chessgml/standards/pgn/pgn-complete.htm#c8.2.3 http://www.saremba.de/chessgml/standards/pgn/pgn-complete.ht...
- liontwist 2y agoThe 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.
- deleted 2y ago[deleted]
- polotics 2y agodon't do that! the word you use a lot in your description is "pair"...