9 ms·
Terse syntax isn't an issue, you just need to get used to reading it. Using 1 character variable names is another matter though. There is no reason not to use
by de_Selby 10y ago
Terse syntax isn't an issue, you just need to get used to reading it. Using 1 character variable names is another matter though.
There is no reason not to use camel cased variable names and indent functions, if/else blocks etc, and when written this way the code can be perfectly legible even to non q programmers.
Something else that leads people into the write-only trap is that the usual way of working with the language is to use the REPL loop while working, where you can tend to be doing multiple things on 1 line. It's just laziness not to reformat and clean up the code afterwards though.
- geocar 10y ago> There is no reason not to use camel cased variable names and indent functions, There is: it makes the program bigger. Program source code length is significant, and if you have more lines, you have more opportunities for bugs.
- valarauca1 10y agoBugs don't hide in variable names or white space. Compiler errors do. But you catch those first run. If tab vs 2 spaces vs 3 spaces can induce a logic error that is a purposely obtuse language.
- geocar 10y ago> Bugs don't hide in variable names or white space. Bugs do hide in variable names and whitespace. thisIsALongVariableName = True thisIsaLongVariableName = True is easy to spot when they're side-by-side, but not so much when they're two pages away from each other. Python's tabs and spaces can confuse the indention in cases so that code that "looks" aligned actually isn't. If you haven't run into a problem caused by a typo, you haven't been programming long enough.
- wott 10y agoThis is indeed a problem with languages without mandatory variable declaration. Is it the case of K, Q or whatever its name is?
- geocar 10y ago> This is indeed a problem with languages without mandatory variable declaration. Typos affect everyone. It is not a function of the language that causes you to mistype. It is that the program is long and you cannot see the whole thing that causes you to miss it. > Is it the case of K, Q or whatever its name is? {foo}[] generates an error because foo is unbound. What's the difference between {foox} and {fooy}? They both might be variables, and yet it is only by reading the program that you can tell which one is correct.
- dx034 10y ago> Typos affect everyone. It is not a function of the language that causes you to mistype. It is that the program is long and you cannot see the whole thing that causes you to miss it. In any language with mandatory variable declaration the code wouldn't even compile. And any decent IDE would even flag this while writing the code.
- geocar 10y ago> In any language with mandatory variable declaration the code wouldn't even compile. Nonsense. memmove and memcpy are both defined, and if you choose the wrong one your program compiles and runs, but it simply produces the wrong result. > And any decent IDE would even flag this while writing the code. There is no IDE that will flag this. Advanced whole-program static analysis has a hard time with this problem and I'm not aware of any general solutions.
- nl 10y agoIs this supposed to be a joke? Or maybe related to some weird coding environment? Long variable names may take more characters, but there is no way they increase bugs. Indenting(!) doesn't even take many more characters if you use tabs...
- ams6110 10y agoMathematical formulas don't use long variable names. They use x, y, and various greek letters.
- Locke1689 10y agoAnd despite lambda calculus being written entirely using single letter variable names, Scheme programmers all use proper word-size variable names in their programs. Mathematics notation is so notoriously awful that mathematicians often can't even read equations from other disciplines without significant extra context.
- maemre 10y agoThat might be because: - you need to write same variable name on each step of derivation of a formula - paper and blackboards don't have autocomplete - juxtaposition is used for multiplication, thus SwapBlue can be Swap times Blue or a single variable called SwapBlue, spacing for multiplication is not a good solution when writing to board/paper
- nl 10y agoThis is generally (amongst mathematicians) considered to be a problem, not a good thing (Source: work with university Math departments). Edit, see http://mathoverflow.net/questions/8295/origins-of-mathematical-symbols-names http://mathoverflow.net/questions/8295/origins-of-mathematic... for the confusion this causes..
- geocar 10y ago> Is this supposed to be a joke? … there is no way they increase bugs. No, it's not supposed to be a joke. Steve McConnell 1993 observed density is proportional to source program length, so this should be obvious to every programmer: If a small program (as measured in source code bytes) is more likely to be a correct program, then this follows. A major issue with discussing programming is the sheer number of people who believe they know how to program, when any non-programmer could see quite obviously that they don't: A professional bridge-builder doesn't often fail to build a bridge, but a professional CMS programmer seems to unable to get much past hello world without a bug or two; Less code will therefore produce less bugs.