Re:Thoughts Around Naming Variables
by bananasbandanas on Wednesday March 03, 2021 @02:38AM
(#26325732)
I agree to some extent of course. If there really are meaningful concepts for intermediates or the whole formula, especially if you are applying it to a specific domain, you should name them.
(I also just looked up the equations and noticed the formula I gave was just completely wrong, so please don't implement a kalman filter like that.)
For example I’m reading a PDF now where you have 6 variables involved - 2x2 matrix D which is decomposed to variables [g h], a set of points R, two points defining a parallelogram P and a vector v — where the definitions are a scattered (based on order introduction/definition to the pdf, since they’re used for other things as well).
I have to keep a LUT to follow any given formula because it’s just plain hard to keep track of anything.
And of course, the second I convert it to code, it all gets real names with arbitrary intermediaries and at least I can read it through in a single pass.
Names are there to remind you what the hell you’re talking about. Mathematics on the other hand always try to be as general as possible — your formulas don’t want to discuss anything specific; any object that fits the required properties will do, starting subject/context be damned.