4 ms·
This would require coming up with an order of magnitude more variable names which is just unnecessary cognitive load.
by AaronAPU 11mo ago
This would require coming up with an order of magnitude more variable names which is just unnecessary cognitive load.
- jstimpfle 11mo agoEither you don't understand what you're talking about, or you've missed the word "strive" in the tweet.
- chongli 11mo agoNo, not at all. You still have the advantages of scopes, name shadowing, namespaces, and collection types. If your language supports them, you can also use algebraic data types to further reduce the number of names you need to deal with.
- furyofantares 11mo agoAn order of magnitude? That sounds like pretty outrageous hyperbole. A variable getting reassigned 10 times sounds extremely rare, the average in my experience has to be less than 1 reassignment. I think the approach requires coming up with maybe 10% more names. Usually there are good, obvious names for intermediate calculations in my experience. I'm open though - what kinds of things are you doing that require reassigning variables so much?
- AaronAPU 11mo agoProbably exaggerated a bit with that phrasing (“outrageous” seems similarly hyperbolic ;)) But any variable which I’ve not already marked as const is pretty much by definition going to be modified at least once. So now instead of 1 variable name you need at least two. So now the average number of variables per non-const variable is >= 2 and will be much more if you’re doing for example DSP related code or other math heavy code. You can avoid it with long expressions but that in principle is going against the “name every permutation” intention anyway.
- furyofantares 11mo agoFair enough re: "outrageous"! It's actually math heavy code (or maybe medium heavy?) where I really like naming every intermediate. fov, tan_fov, half_tan_fov, center_x, norm_x
- AaronAPU 11mo agoI spent a decade or so working on video codecs with an international team, and there was sort of an unwritten rule that code shouldn’t have comments and variable names shouldn’t be descriptive (english language couldn’t be assumed). Which sounds really awful, but after a while it forces you to parse the logic itself instead of being guided by possibly-out-of-date comments and variable names. I now prefer less verbosity so that probably explains why I’m a little out of distribution on this topic. If you looked at any of my code prior to that job, it was the polar opposite with very “pretty” code and lengthy comments everywhere.
- 1718627440 11mo agoThis is kind of the opposite of LLMs, they seem to derive meaning mostly from the variable names, not from what the code actually does.
- AaronAPU 11mo agoI haven’t noticed that, will have to keep an eye out. Could help explain some quality inconsistencies.
- deleted 11mo ago[deleted]