1. 10
  1.  

  2. 19

    Things like font and your color background seem like microoptimizations in the face of the things that we know dramatically improve cognitive performance: adequate sleep, short workdays, proper nutrition. If we’re talking about cognitive load, those are the things that should be addressed first.

    Unrelated, one thing I find makes reviewing code much easier and more pleasant: printing it out. Then I can mark it up with a pencil.

    1. 7

      Some interesting thoughts, but I have a personal nit-pick:

      After several years of programming, I can safely say that about 80-90% of comments are redundant

      No, you can’t, unless you’ve actually measured, and then you should provide some evidence (number of code bases examined, number of comments total, etc). It bothers me that people feel the need to make up a percentage. Just saying “most comments are redundant” is fine; there’s no need to quantify it with an imaginary proportion.

      1. 4

        If most of your comments are redundant, then you need to get better at writing comments.

      2. 3

        A lot of personal stuff in there:

        • First font looks better for me
        • Folding is obviously good thing but depends on editor a lot (i.e. vscode giving me empty } in line bellow sux)
        • White background is instant turndown, not only for me, but many devs I know - and not only while codding but everywhere - OS, browser (dark reader, omg, thank you), so no, I couldn’t even watch at your screen not to mention analyzing code.

        I have my personal code style that is.. personal… I think this is unavoidable unless there is community effort such as gofmt. Not sure what to think about it really, programming is also art of expression - I spend much time deciding what to go on the same, what on different line, what should have empty line in between, what not, what comment, do I use alias or more verbose variant. I certainly do not like machine making those decision for me.

        For example, I prefer to put micro-thoughts on single line and tend to design constructs so they actually fit on single line. Achieving that depends on the language (i.e. its widely different in C#, Autohotkey, Clojure or Powershell). I also hate if’s and almost never use them - they add to code fiber quite a lot so you have to use scroll and things do not fit the single screen which is distracting, so most of my code using ifs is actually just if (err) return/throw so I do not have to ident like what I found in majority of code if (!err) then {..... Then I always use empty lines between setup/execute/assert phases and no empty lines inside of them (in automatic tests) and I am really bummed if I can’t. :) And finally, I hate opening curly braces solo on a new line with a passion and totally opposite with the closing braces.

        I detest making this kind of art “machine doable”. I am happy because it exists. Maybe I wouldn’t even do programming without it. I had number of discussions about using PowerShell aliases for example. ( I prefer them for reduced cognitive load, others mostly whine for no good reason). People will PR me alias cleanage at least once per month for some rason on my github repos.

        Regarding colors, the paper that is referenced from previous century obviously do not apply any more (imagine, world and usage patterns of stuff changes with passage of time so what was once OK, now can suck, or maybe it was wrong all the time).

        Now, perhaps all this should apply to mediocre or n00bish developers. What I have seen in the wild might probably be way better when cleaned even by machine.

        1. 3

          I would like to claim based on nothing other than my own prejudice (I believe this is known as “strong opinions, weakly justified”) that the practice of formatting comments in a low-contrast colour (e.g. gray on black) is a bad one, and leads to comments becoming out of date or orphaned from the code they’re supposed to be part of, because maintainers don’t notice them.

          If you’ve had to use a comment to say something you couldn’t have expressed in code (which for me is usually why you did it that way, why you didn’t do it another way, or what you plan to do with it in future) then it’s potentially the most important thing on the page, not the least important.

          (If on the other hand you’re using comments to hide parts of the code from the interpreter, then I can see an argument for “greying it out” - but then, that should be a strictly temporary state of affairs and you should really be expecting either to reinstate the code or delete it completely before the code is pushed/merged/widely shared)

          1. 2

            One more observation about colours is that many editors/IDEs seem to be using far too many of them, IMHO. Every little thing is a different colour.

            I find colouring just a few key items (e.g. comments, keywords, string/int literals) provides a much better experience. There is some tentative research to back this up (although that relates to colours in flight controller displays, so not completely sure if that can be translated 100% to programming).

            1. 1

              I took an interview yesterday which involved coding. The editor they had me use had syntax highlighting, which I have turned off on my own machine. I enjoy having three colors: background, text, and highlight (search results). That’s it. Everything else is visual noise.

              http://www.linusakesson.net/programming/syntaxhighlighting/

            2. 1

              Was convinced by this post to start using code folding by default in Golang. I gotta say, I’m definitely enjoying it, its just so much more natural to see a file’s structure inline with the code.