5 ms·
Except that (good) code is written to be read, and to be understood - and not be terse and cryptic, just so that people writing it have less to do. That's essen
by slowpoke 14y ago
Except that (good) code is written to be read, and to be understood - and not
be terse and cryptic, just so that people writing it have less to do. That's
essentially what most math texts do. I don't want math to be prose, but often,
a little more verbosity or communication of intent would be nice. Just like
good comments and documentation. In CS, this is universally accepted as good
style, and for very good reasons - and for the same reasons, it should be in
math, as well.
- hackinthebochs 14y agoI think you're misunderstanding the purpose of the terseness of mathematics. The point is to convey the important concepts as cleanly as possible, assuming your reader has a certain level of prerequisite knowledge. The same can be said about code: you assume your reader has a certain level of understanding of the domain that you're modelling through code. The terseness is a virtue, in the sense that only the critical bits of new information need be conveyed. All the prerequisite knowledge is hidden behind abstractions that the reader should be familiar with. Math, and code, is cryptic if one doesn't have the prerequisite knowledge, but this is by design.
- slowpoke 14y ago>The same can be said about code: you assume your reader has a certain level of understanding of the domain that you're modelling through code. No, this is not at all the same. Code can be read without understanding everything if it is well documented. Yes, code should be short and simple, too. But not terse and cryptic - and that's what so many math texts do. So yea, cool, you can compress half a page of written English into half a line of mumbo-jumbo. Great. You have gained nothing. I'm not saying that the half page of written English is better. Not at all. But there's something somewhere between those two where math should be. And not at the cryptic end of the scale. Take just simple things such as meaningful variable naming. There are tons of good reasons why we do this in programming. I can't count the number of times I've tried to decipher math texts and had to look up over and over and over again what some x or f or lambda or phi is actually supposed to represent. It gets worse when they start making distinctions based on the bloody way a symbol is typeset (x vs x). It's perfectly fine to do this in quick calculations on paper (just as it is fine to use one character variables in quick one-off scripts). But if you are writing a prolonged mathematical text, then take the time to give variables meaningful names. It's not that hard, and would go a long way for improving readability.
- hackinthebochs 14y agoI don't think descriptive variable names would be useful in math. The thing in math is that "x" you see can be repeated 20 times in a set of equations. Having to read "running_total" 20 times instead is a hindrance here rather than a benefit. The difference between math and code is the number of variables. A piece of code can have an order of magnitude more variables than a set of math equations. But in math, a few variables will usually be repeated many times. You're simply optimizing different usage profiles. So the benefit in descriptive names in code is being able to distinguish easily the many different variables. The benefit in single letter variable names in math is that you're able to write the information in a more compact, digestible manner. The reason this latter point is important is for the same reason short, compact programming languages are a boon to comprehension. The faster you can read a set of related items, the more of it is in your working memory at any given time and thus the better you're able to understand it. I fully believe the time it takes to input a chunk of information through your visual system is inversely related to one's understanding of it. To put it another way, working memory's decay function is parameterized by time.
- slowpoke 14y ago>The benefit in single letter variable names in math is that you're able to write the information in a more compact, digestible manner. You missed my point entirely. I said that you should not optimize for writing math, you should optimize for reading math. And that's where the same argument as for code holds true as well: It doesn't matter if it takes longer to write, it will be read magnitudes more often, and that is what matters most. Again, if you're just doing quick calculations on paper or hacking something into your shell/REPL, I really don't care if you use cryptic variable names. I do, too. But I don't want to ever see this in a good program, and I think that it doesn't belong into a good math text, either. >The reason this latter point is important is for the same reason short, compact programming languages are a boon to comprehension. And again you missed what I explicitly stated: it's good to write in a concise way, but only as long as it doesn't become cryptic. And I disagree with your belief about information processing. It's better to build semantic relations by having meaningful names than it is to process a lot of information in a short time. It really doesn't matter how fast you are able read something - if it doesn't make sense, you won't understand it.