This didn't sit quite right with me and I think I'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 "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.<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 "play" which is the act of moving from a particular board position. The code would then be:<p><pre><code> let difficulty_by_play = //...;
let existing_plays = //...;
let unique_moves_by_play = //...;
fn play_to_condition((epd, san_plus): &Play) -> _ //...;
</code></pre>
The result is legible, the concept is meaningful, and a naive reader could make sense of the variables and operations. No cognitive / conceptual overhead.<p>Cleaner code, I would claim.<p><a href="https://en.wikipedia.org/wiki/Domain-driven_design" rel="nofollow">https://en.wikipedia.org/wiki/Domain-driven_design</a>
<a href="https://en.wikipedia.org/wiki/Extended_Position_Description" rel="nofollow">https://en.wikipedia.org/wiki/Extended_Position_Description</a>
<a href="http://www.saremba.de/chessgml/standards/pgn/pgn-complete.htm#c8.2.3" rel="nofollow">http://www.saremba.de/chessgml/standards/pgn/pgn-complete.ht...</a>