4 ms·
Using easily readable/recognizable variable names is one thing computer programmers got right. It's always frustrating to read mathematic or economic models th
by michaelchisari 12y ago
Using easily readable/recognizable variable names is one thing computer programmers got right. It's always frustrating to read mathematic or economic models that use symbols instead.
I'm sure there's a good reason for it, but I haven't heard it yet.
- jacobolus 12y agoThe reason is that it makes everything much more compact, which facilitates symbolic manipulation by reducing the space that symbols take, so that the differences between each step can be easily spotted, and in particular so that it’s easier to write down each step, which is especially important when working with pencil and paper. The problem with short cryptic symbols comes when there are so many symbols that it’s hard to keep them straight, when symbol uses fall far from their definitions, when the same symbol is overloaded to mean different things, or when the author’s and the reader’s cultural conventions about symbols are different. In a programming context, short variable names are extremely handy when either (a) the scope of the variable is limited, or (b) there’s a strong convention associating the name with the meaning, so that someone seeing the name knows immediately what it represents. For example, writing pi instead of circle_constant, writing i instead of loop_index, etc. tends to make code more readable rather than less.
- yummyfajitas 12y agoFurther, there are often conventions as to which symbols are used in which context. For example, \phi and \psi (with subscripts) are commonly used as a basis/frame for a vector space, \delta commonly represents a difference of two quantities, \rho is typically a density and \gamma is a decay rate. (These examples are fairly physics-specific, but other fields have similar conventions.) So if notation is well chosen, the reader doesn't need to remember as much unique notation as one might expect.
- saraid216 12y agoI've read some computation-heavy processing using long-form variable names in code and it's not actually readable. For parameter passing, long-form names make sense. For actual math? Not so much.
- SamReidHughes 12y agoIf you use the symbols that are used, frequently, you get better at using them. It's much like the way if you play a round of golf at a course that you're unfamiliar with, it's a lot harder to recall a shot-by-shot recap of your round than if you play the course regularly. The mind builds little registers for keeping track of the meanings of Greek letters if you use those little friends often enough.
- PaulJulius 12y agoI find your choice of analogy a little amusing. In these circles, I think more people would have significant exposure to dense mathematical notation than significant familiarity to a particular golf course.
- SamReidHughes 12y agoYeah, well, yeah. It just happens to be the only way that I've measurably and comparatively observed this sort of memory phenomenon in my personal experience.
- kszx 12y agoWriting out long variable names while working on a mathematical model is like writing the same text with ten times the number of characters. It's neither elegant nor efficient. Imagine you're playing around with variables and model configurations in complex mathematical terms, but one formula stretches over two pages and you always need to cross out and rewrite whole words.
- gcb0 12y agowe're not taking about homework but published paper. i don't publish code at conferences with var x, j, i, ii, iii, i2, h, ji... even though i find it pretty convenient when writing prototypes. math people are just sloppy :)