TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

A made-up name is better than no name

62 点作者 marcusbuffett6 个月前

22 条评论

efitz5 个月前
I really don’t like this idea if you are sharing this code base with anyone else.<p>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.<p>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.<p>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.
评论 #42323294 未加载
评论 #42323594 未加载
评论 #42323414 未加载
评论 #42323080 未加载
评论 #42323443 未加载
评论 #42340436 未加载
评论 #42323407 未加载
评论 #42327226 未加载
评论 #42326564 未加载
deathanatos5 个月前
… a company I once worked at named everything after characters from a certain TV show. Effectively the same as a made up name. Let&#x27;s just say one of the character&#x27;s name was … a tough one to pronounce. And it caused endless &quot;what&#x27;s a … Kep?&quot; type questions.<p>The CTO at some point later on decreed &quot;enough; descriptive names, not made up things&quot; … and the experience was such that I agreed with the decree, and I&#x27;ve sort of felt that way ever since. I&#x27;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&#x27;t clear yet and thus &quot;descriptive&quot; can be hard to come by.<p>You could have named it a &quot;PoMo&quot; (portmanteau of position-move), if you&#x27;re tired of typing.<p>I&#x27;m also a bit surprised since the examples are Rust? Some of the naming is sort of &quot;Hungarian notation&quot;-esque. Why not let the type carry that information, and strike it from the name?
评论 #42323279 未加载
serbuvlad5 个月前
If it occurs often enough, yes!<p>The human brain finds unexpected or weird words a lot more memorable than expected words.<p>grep is better than find &quot;find-regular-expression&quot;<p>awk is better than &quot;execute-command-on-regular-expression&quot;<p>perl has nothing to do with pearls<p>If it&#x27;s a common command, concept, function, etc. that appears in may places, give it an odd name!<p>Document it thoroughly!<p>And don&#x27;t go overboard. When everything is special, nothing is, with the added disadvantage that nothing is &quot;readable&quot; either.
评论 #42323295 未加载
评论 #42323248 未加载
评论 #42323224 未加载
cxr5 个月前
This is good if you&#x27;re good at coming up with names that are good, even if they&#x27;re inscrutable. If you&#x27;re not so good at it, or do too much of it, then you end up getting a situation like the Urbit ecosystem.
Empact5 个月前
This didn&#x27;t sit quite right with me and I think I&#x27;ve pinned down why.<p>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.<p>If the name requires specialized knowledge, such as &quot;what does this name mean,&quot; 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.<p>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?<p>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.<p>So an EPD SAN is a particular board position when a particular move is applied to it. I propose to call the combination a &quot;play&quot; which is the act of moving from a particular board position. The code would then be:<p><pre><code> let difficulty_by_play = &#x2F;&#x2F;...; let existing_plays = &#x2F;&#x2F;...; let unique_moves_by_play = &#x2F;&#x2F;...; fn play_to_condition((epd, san_plus): &amp;Play) -&gt; _ &#x2F;&#x2F;...; </code></pre> The result is legible, the concept is meaningful, and a naive reader could make sense of the variables and operations. No cognitive &#x2F; conceptual overhead.<p>Cleaner code, I would claim.<p><a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Domain-driven_design" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Domain-driven_design</a> <a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Extended_Position_Description" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Extended_Position_Description</a> <a href="http:&#x2F;&#x2F;www.saremba.de&#x2F;chessgml&#x2F;standards&#x2F;pgn&#x2F;pgn-complete.htm#c8.2.3" rel="nofollow">http:&#x2F;&#x2F;www.saremba.de&#x2F;chessgml&#x2F;standards&#x2F;pgn&#x2F;pgn-complete.ht...</a>
评论 #42325447 未加载
throwuxiytayq5 个月前
Cuts both ways - often it&#x27;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&#x27;d keep the Kep.
mouse_6 个月前
This works great if you&#x27;re absolutely certain no other poor sap is going to have to work with your code. I do this myself for personal scripts!<p>Otherwise, please prioritize readability.
评论 #42323112 未加载
评论 #42323009 未加载
评论 #42322746 未加载
wruza5 个月前
<i>wasn’t a mouthful like MoveFromPosition</i><p>PosMove, but nothing wrong with MoveFromPosition either.<p>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.<p>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&#x2F;personal ones, or name comments at least). But that’s rocket science for text-based sources.
fundad5 个月前
I like this and seeing Kep reminds me of kip, a currency, and that got me thinking that currency names is a fun source of &quot;made-up&quot; names for things.
not2b5 个月前
Sure, a made-up name is better than no name, but a mnemonic, logical, understandable name is far preferable. Perhaps just more thought is needed.
einpoklum5 个月前
&gt; A Made-up Name is Better Than No Name<p>Perhaps, but a meaningful name is better than an arbitrary made-up name.
评论 #42325195 未加载
评论 #42323301 未加载
评论 #42325161 未加载
david-gpu5 个月前
I 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.<p>Thank you Tim! You did us a solid.
评论 #42323528 未加载
SPBS5 个月前
This is awful. The alternative isn&#x27;t &quot;no name&quot;, it&#x27;s a full and unambiguous name (even if it&#x27;s a mouthful). If you can&#x27;t come up with a good short name, stick with the long one.
beastcoast5 个月前
I’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 :)
Daneel_5 个月前
Not 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.<p>Over the years I’ve learnt to prioritise readability and to never abbreviate. Tab completion makes it a non-issue.
johnea5 个月前
Aren&#x27;t all names &quot;made up&quot;?
评论 #42325325 未加载
ghjfrdghibt5 个月前
I often remove the vowels, so I&#x27;d have probably gone with &#x27;pdSn&#x27; as the shorthand for it.
评论 #42323253 未加载
评论 #42323851 未加载
aragonite5 个月前
Instead of &quot;kep&quot;, if you want something that visually stands out, there are also lots of fun little symbol-like characters you can use, even when you&#x27;re dealing with a language where identifiers are limited to ID_Start&#x2F;ID_Continue (e.g. Javascript, Rust). My favorite collection :)<p><pre><code> ⴵ ⵛ ꘜ ⵣ ꕤ ꖜ ꘖ ꧮ ⴲ Ⰴ Ⰺ</code></pre>
评论 #42323423 未加载
评论 #42324016 未加载
hakuseki5 个月前
The article is about (position, move) pairs. Why not call these objects &quot;steps&quot;?
评论 #42323550 未加载
Terr_5 个月前
A made-up name is fine <i>if</i> (A) your code is private and (B) fixing it later is easy.
deskr5 个月前
Disagree, especially using that first name pops into your mind.<p>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 &quot;the first thing that comes to mind&quot;.
评论 #42325693 未加载
polotics5 个月前
don&#x27;t do that! the word you use a lot in your description is &quot;pair&quot;...