3 ms·
On one hand, the abbreviations are extra mental work. On the other hand, when you start composing fairly complicated chains together, all those extra letters a
by retrac 5y ago
On one hand, the abbreviations are extra mental work. On the other hand, when you start composing fairly complicated chains together, all those extra letters are also extra mental work. Neither is inherently right, but I do prefer something like the former here (just making up something emulatorish):
mw(cpu.r[0], mr(mr(cpu.r[1])));
memory_write(processor.register[0], memory_read(memory_read(processor.register[1])));
- nomemory 5y agoThis was exactly my reason to shorten the name, even if most of the feedback I've received is related to the "weird" naming conventions. Initially mw was mem_write and mr was mem_read, and reg was registers, etc. But because I wanted to keep the functions as short as possible (to put them on the single line without making them totally unreadable), I've comeup with those names, which are confusing at first.
- ativzzz 5y agoWhen you're optimizing for a metric like lines of code written, then abbreviations make sense. If you're optimizing for readability you could do something like (I'm not a C programmer so IDK if this is syntactically correct C): ` memory_write( processor.register[0], memory_read( memory_read(processor.register[1]) ) ) ` To me, multiline statements are much more readable than single line nested statements regardless of abbreviations used.
- johnisgood 5y agoI do this sometimes when the line gets too long due to long names. I do not like it.
- userbinator 5y agojust making up something emulatorish Double-indirect through memory? I think that's something only VAX has.
- dTal 5y agoI think this boils down entirely to how comfortable the reader is with the concepts involved. If you have to stop and think for a sec about what "memory_write" actually does, the spelled-out words are a useful prompt and the time it takes to read them is not a bottleneck. But if you're used to thinking at level of abstraction, used to tossing the concepts around in your head like mathematical symbols - then the shorter version is preferable and the longer one feels boggy and pedantic. This is why regex is a thing and why people skilled in APL rave about it so much, and why nobody ever bothers to symlink rm, cp, and mv to remove, copy, and move respectively.