News for hackers. Stuff that matters.
Re:The Hardest Program I've Ever Written by chriswarbo on Thursday September 10, 2015 @05:38AM (#10197029)
I think code formatters are a great idea, but they're not quite clever enough for me yet.

For example, if there's a common pattern among a set of lines, I'll often line them up vertically to make the repetition clear and focus attention on the differences rather than the commonalities; for example:

    if (foo  ||
        quux ||
        baz) {
      ....
    }

    let foo  = 10
        quux = foo  * 2
        baz  = quux + 1
     in baz * 2

    fields = ['name', 'address', 'country',
               'dob',  'status',  'salary']
To me, those few extra spaces make it easier to glance over the code than without:

    if (foo ||
        quux ||
        baz) {
      ....
    }

    let foo = 10
        quux = foo * 2
        baz = quux + 1
     in baz * 2

    fields = ['name', 'address', 'country',
              'dob', 'status', 'salary']

There are no comments on this comment yet.