4 ms·
I have been questioning the "programming languages are for humans, use full names" principle recently. Why do we have a tendency, as humans, to create abbreviat
by kazagistar 13y ago
I have been questioning the "programming languages are for humans, use full names" principle recently. Why do we have a tendency, as humans, to create abbreviations so often then? Mathematicians get upset if an operation uses more then a single character or symbol to express it, and are willing to have massive amounts of overloading to achieve it.
- couac 13y agoMaybe because we are lazy, and we think that abbreviations save time/energy, which is obviously a wrong assumption.
- kazagistar 13y agoAgain, the "obviousness" cuts both ways. In other words, it is obvious to mathematicians that concise symbols are better, and it is obvious to programmers that verbose strings are better, and both have a lot of experience backing their claims... if anything, math has more. So, I think the real question is how do we quantify and measure it? How do we gather the formal and empirical data needed to resolve this issue?
- alipang 13y agoSure, but mathematical language only applies to very specific concepts. You're free to talk about the applied domain (if not pure math) using informal text. Programs need to be interpreted by a computer, and as such need to be written in a formal language everywhere, and as such has a larger amount of concepts that need to be formally modelled. More concepts means we need more descriptive names to be able to distinguish them.
- hackinthebochs 13y agoMath uses single letter/symbols usually because those letters have a very short scope, and they are always well defined before usage (or there is a pattern that any mathematician would recognize). Also, short naming is a boon in math because the mathematical objects defined are pretty constant: everyone learns the same notation and that notation becomes the basis for the next layer of abstraction. Programming by its nature is an exercise in re-enventing the wheel (how many different semantics are there for opening a file in all the different languages in use?). Also, the sheer number of algorithms and abstractions in use in programming dwarfs that of mathematics.
- TeMPOraL 13y agoI think it's because a) math started on paper, and b) the way you interact with math documents is different than the way you work with code. Most of conventions used in math come from the time before computers; on paper, every character you don't have to write by hand is a big time-saver. Moreover, math papers tend to be read top-down. You start at the beginning, and gradually build your understanding and "symbol-to-concept" mapping table as you go down. Whereas in code, you often just jump in the middle of a file to change something, and you don't want to read 1k lines of code in some random place to determine what f(a,b,q(z)) means. Descriptive names allow you to have all the context you need inferable locally. Note that many good principles of programming are exercises in maintaining locality. Reducing program state, functional programming style (function output depends only on inputs, not on hidden state), writing small functions, building abstraction layers (treating one layer as a "programming language" for the layer above) - all of these allow you to understand and change the code you're working on without having to look at unrelated things.
- vickytnz 13y agoAlso margin of error: the longer the name is, the more likely you'll mistype it somewhere and screw everything up.
- dalore 13y agoMost IDEs have code completion. It's a boon with long descriptive names as you are more likely to pick the right one. Just start typing the method name of something that might work and pick the correct method.
- dragonwriter 13y ago> Mathematicians get upset if an operation uses more then a single character or symbol to express it, and are willing to have massive amounts of overloading to achieve it. Because context-switching and then processing concise symbols in that context is more efficient for most people's brains that processing prose.
- kazagistar 13y agoSo why would it be any different in programming?