5 ms·
looking at the left is nice, you can see all the various functions very quickly. but the actual code just looks like visual noise to me, blending together, not
by asddubs 4y ago
looking at the left is nice, you can see all the various functions very quickly. but the actual code just looks like visual noise to me, blending together, not clear where sub-blocks are within functions, "lines" (as in units separated by semicolon) blending together too.
If I was tasked with changing anything in there, or analyzing the code, the first thing I would do is run autoformat on it. even if I have to preserve the code style, I would just translate it back once I'm done
One thing I notice myself doing a lot is using lots of empty lines in my code. Sometimes I go really overboard with it, to the point that every other line is empty. I feel like it helps me read the code more easily. This seems sort of like the antithesis of that.
- tough 4y ago> One thing I notice myself doing a lot is using lots of empty lines in my code. Sometimes I go really overboard with it, to the point that every other line is empty. I feel like it helps me read the code more easily. This seems sort of like the antithesis of that. One trick for that is making your height line higher in focused mode in the editor. An ex co-worker had this on VSCode and looked very useful.
- shubb 4y agoImagine if lawmakers got this hung up on indentation. Not the wording, correctness, or effect. The indentation. We would say they were fiddling while Rome burns. If you are working on your own you do you. If you are working in a team pick a style that is okay and has great tooling and support in different editors. As this exchange proves everyone has opinions about this stuff. Standardisation is more important than optimal choice especially as everyone thinks theirv choice is optimaland yours is terrible. It doesn't have a huge impact, solve it once and make it go away so you can focus on everything else. Just set git to format everyone's code on checkin and never talk about it in a code review again.
- peteradio 4y agoYes, let's follow the lawmakers excellent example of swift coherent action.
- asddubs 4y agoSure, but this thread of conversation started with someone specifically asking for opinions on their indentation. It's not like the discussion was about the code, and this is just a big side-track of the actual discussion.
- smallest-number 4y agoI think the semi-obsession we have with "correctness" in style is actually something programmers do a lot better than most other disciplines. Arguing over indentation is functionally the same as arguing over unix principles, or frameworks or languages. The fact that we're always looking not just for the solution, but the right solution, on every level of the process, is part of what makes programming so beautiful and enjoyable. Law is actually a perfect example of the opposite; without that obsessive concern for correctness, the systems created are hopelessly confounding and difficult to navigate.
- david422 4y ago> Imagine if lawmakers got this hung up on indentation. Not the wording, correctness, or effect. The indentation. I mean that seems reasonable to me. If someone submits a giant bill with no indentation/paragraphs/punctuation etc. then it should be rejected. Being able to grok the bill itself would be an important part of then determining whether or not to pass it.
- blatant303 4y ago> If I was tasked with changing anything in there, or analyzing the code, the first thing I would do is run autoformat on it. even if I have to preserve the code style, I would just translate it back once I'm done This could be done with local reindentation/deindentation. You'd need some way to map back to the original style, maybe treating the whole process like a git edit, putting a newline before each new addition, highlighting it, with a checkmark button to "commit" them once the indentation is adapted to the original style, and by "commit" I mean make the highlighting go away. However the criticism about the right part of the code being visual noise I see in your reply and others is somehow unfair, the second pic bordering on the limits of what I find acceptable myself. It's still linguistically readable as in you'd still be able to replace the parens and braces by reading that one line of code aloud. It's not code that's supposed to be readable in a typographical sense, with harmonious spacing meant to catch the wandering eye like an ad, it's code that was written to be thought through. Sit and think. For 30 minutes before hitting 'build'. After minor compilation errors and the first successful build, I had just a single one-line fix to make before having the code run correctly.
- asddubs 4y agoI would still find it easier to sit and think about the code if it was formatted differently. To me, this reads like a book that's just one long paragraph.