News for hackers. Stuff that matters.
Re:Applying the Gestalt Principles to Code by cjfd on Sunday May 05, 2019 @06:42AM (#19832146)
100% agree. These optimizations in readability help a lot. Also, a failure to optimize code for readability makes reading code difficult. I once read some code where I immediately concluded that something was wrong because a function was being called from the wrong method. Turned out that it actually was in the right method but there was no vertical space between two methods giving the wrong impression of where that particular method call actually was. I feel quite alone with this opinion though. I see messy code all around me. One particular thing that everybody seems to agree on but that is pretty much objectively bad is the common way to line up lambdas. People do

  some_object.some_method((p, q) =>
  {
     do_things()
  })
while the right way of doing this clearly is

  some_object.some_method(
     (p, q) =>
     {
        do_things()
     })
The 'broken lambda' that one tends to see everywhere is driving me nuts.

The principle is that code already should give the right impression of what is going on at the first glance. Another thing that is quite a spectacular failure in this regard is the google style guide. The indents of 2 tabs combined with braces that do not line up must have been optimized to be as unreadable as possible.

Re:Applying the Gestalt Principles to Code by majewsky on Sunday May 05, 2019 @08:19AM (#19832420)
See, that's how different people are. For me, the clearest formatting is obviously

  some_object.some_method((p, q) => {
    do_things()
  })
Your preferred version has way too much useless whitespace.