4 ms·
"You see what you've done though? You've defined everything that is not your personal preference of 2 spaces (I could live with this one at least) to be wrong."
by coreyp_1 9y ago
"You see what you've done though? You've defined everything that is not your personal preference of 2 spaces (I could live with this one at least) to be wrong."
No, I've stated that making me change my tab settings to read your code is wrong. If you want to use 3 spaces, then that's perfectly fine with me. Just don't make me change my settings in order to understand what you have written.
"Oh please tell me this universal definition of readability..."
My universal definition is that code should be understandable. Not obfuscated. Not verbose. Whitespace is the issue that we are talking about here (but it is definitely not the only issue), and 4 spaces is fine if the code allows it. But if you have 11 levels of indentation, then 4 spaces is silly. Some languages lend themselves to a heavily-indented structure (especially object-oriented class definitions), and 4 spaces make them unreadable.
As for the last point, I agree, but I disagree that the variations in fonts and colors are of the same impact as having the wrong tab width. Again, I refer to my teaching experience. Colors, fonts, font sizes, line wrapping, screen sizes, etc., do not confuse beginners. Tabs do. They are invisible (unless you know the magic setting to make them visible in your particular editor) and they hide spaces (a space followed by a tab aligns with a single tab), which causes problems in a language like Python.
[edit: adding this paragraph]
The best parallel to the preceding argument is if you wrote code that required a specific font, color, etc., in order to read it clearly, then that would be bad programming, IMO. This is not the case, however, with any IDE that I have seen. That is also why I do not consider these variations to be of the same level as tabs vs. spaces.
I get it. Spaces are explicit; tabs are variable. You consider it a feature. I consider it a liability.
- flukus 9y ago> No, I've stated that making me change my tab settings to read your code is wrong. If you want to use 3 spaces, then that's perfectly fine with me. Just don't make me change my settings in order to understand what you have written. That's exactly what tabs do and exactly what spaces don't do. If the code is tabbed then it will use the editors tab width and no one has to change settings. I can open the code on my computer and get a tab width of 4, you can open it on yours and get a tab width of 2, it'll show whatever tab width your editor is set to. Everyone is happy. With spaces on the other hand, if I decide I want 4 spaces for indentation then you're going to get 4 spaces when you read the file. You'd have to reformat the whole file to be able to read it. > I get it. Spaces are explicit; tabs are variable. You consider it a feature. I consider it a liability. But you seem to want the variability, you don't want to be subjected to my setting of 4 spaces because you find it unreadable.
- coreyp_1 9y ago"But you seem to want the variability, you don't want to be subjected to my setting of 4 spaces because you find it unreadable." No. I want consistency. If you use 4 spaces and it is readable, then I don't care. But I want to see it the way that you wrote it in order to make that judgement. If I am looking at two different files that were written by 2 different people using 2 different tab width settings, I don't want change my tabwidth per file, just to read it clearly. This is especially a problem where continuation indents are used, and all readability is lost with the wrong tab setting. It is needlessly messy. Using spaces (even if they each used a different number of space indent) would ensure that I see the file as they intended it to be read. That is consistency, and that is what matters to me. If you use a different number of spaces than me, then that is entirely fine. By using spaces, then I will see your code as you see it. If you use tabs, then all bets are off.