| ▲ | ivanjermakov 4 days ago | |||||||
I noticed that when I write code that is not trivial to understand I tend to extract intermediate values into variables with meaningful names.
This way code gets more natural language anchors which helps understanding what it does. | ||||||||
| ▲ | codemonkey-zeta 4 days ago | parent | next [-] | |||||||
I find that Lisps encourage this behavior more than other languages. Many (most?) of the lisp functions I read have the exact same structure:
I find that this makes skimming lisp code much easier, because I can usually skip reading the bindings and just read the function name and ultimate expression and usually get the gist very quickly.You might wonder how this is different than the example you provided, and the answer is because you could sneakily intersperse anything you wanted between your imperative bindings (like a conditional return statement), so I actually have to read every line of your code, vs in a lisp `let` I know for a fact there is nothing sneaky going on. | ||||||||
| ||||||||
| ▲ | TZubiri 3 days ago | parent | prev | next [-] | |||||||
Funny how even in this very verbose code (which is perfectly fine btw), there's still a need to use shorthands (quadVel). It's like completely explained code requires so many words, but we need to fit the code into a certain character window. | ||||||||
| ▲ | necrotic_comp 4 days ago | parent | prev | next [-] | |||||||
I appreciate this way of programming - also, if I may, in the age of auto-complete I think it's okay to have verbose variable naming. Imho, it's perfectly fine to have quad, quadVelocity, dragMagnitude, etc. I see this a lot in the wild, though - as an honest question (not trolling!) why do people still shorten their variable names in place of having a terse descriptor ? | ||||||||
| ||||||||
| ▲ | 8note 2 days ago | parent | prev [-] | |||||||
you can get a few more anchors in with a builder:
which i think points at a possible bug where there drag coefficient isnt measured for the frontal area and needs to be rescaled? | ||||||||