|
|
|
|
|
by zenithd
1597 days ago
|
|
> Why is it that software engineers in a few decades have come to the conclusion that proper variable naming is important and abuse of sigils a bad idea but mathematics don't feel the same way? If yo read code in standard libraries, you'll see a lot of either single-letter variables or extremely generic variable names. Most mathematics is dealing with things at least one level of abstraction higher than a standard library. In most programs outside of things like standard libraries, a variable usually stands for something concrete and specific. A customer. An order. A specific type of element in a UI. Etc. In theory papers, a variable usually stands in for something generic and general. An arbitrary program. An arbitrary finite set. Etc. Sometimes even an arbitrary program in a programming language that is not defined in particular but only in general (e.g., "any language with parametric polymorphism", "any language with a specific sort of binding structure between things in these two syntactic categories", etc.). Again, standard libraries already start using more generic variable names, and most theory papers are dealing with an abstraction level higher than standard libraries. |
|
1. A byte is pretty damn concrete. The Java byte implementation [1] uses almost exclusively single-letter names (b,s) or names that are so generic that they might as well be single-letter names (e.g., anotherByte instead of b). When more meaningful names are used, it's because they are public type names (String, int), which is, again, pretty damn concrete.
2. The next level of abstraction is Generics. Here, even Java -- a language whose verbosity is a long-standing joke -- starts using single-letter variable names for both types and values [2].
3. Finally, we dive into things that abstract over generics [3] and start seeing weird sigils in addition to single-letter names. (What does Predicate<? super E> mean?!)
And, again, this is a strong-manned example, since Java is famously verbose and I'm choosing some of the most-used and therefore most verbosely documented .java files in the world.
Notice, btw, that natural language documentation increases as the verbosity of names decreases. This is the same in math, where those symbols are small pieces of 20+ page papers full of english prose explaining the meaning of the symbols.
And, again most mathematics is dealing with things at least one level of abstraction higher than anything you find in a standard library. Sometimes several levels of abstraction.
[1] Byte.java
[2] Dequeue.java
[3] Collection.java