News for hackers. Stuff that matters.
Re:Why I vertically align my code by geocar on Saturday November 29, 2014 @01:11PM (#8674482)
This behaviour promotes scanning instead of reading. If you make assumptions that:

    var totalBi11 = apply_tax(initia1Bi11, taxRate);
actually does what it says, you might miss something obvious.

I also think if you have four temporary local variables:

    int robert_age     = 32;
    int annalouise_age = 25;
    int bob_age        = 250;
    int dorothy_age    = 56;
then you're missing a trick for a better data structure.

If you never have a bunch of local variables, then you'll never need vertical alignment. I think it would be a lot easier to have a discussion about this with a less contrived example.

Re:Why I vertically align my code by wsidell on Saturday November 29, 2014 @01:23PM (#8674544)
Why are you arguing against clear code that tells what you are doing? Imagine if you used a library with a function called sortAlphabetically that didn't sort items alphabetically, it wouldn't make sense.

Regarding the alignment, there will be situations where there will be multiple similar lines of code that would benefit from being blocked together with vertical alignment. Not only in the case of temporary local variables. Imagine a situation where a bunch of constants for an API are defined as such:

  #define kURLAPIBase      @"http://google.com"

  #define kURLAPIGetUser   @"/getUser"

  #define kURLAPIGetPosts  @"/getPosts"
There are numerous possible situations where things like this can occur. You seem to be arguing for the sake of argument here.
Re:Why I vertically align my code by geocar on Saturday November 29, 2014 @01:39PM (#8674613)
> Imagine if you used a library with a function called sortAlphabetically that didn't sort items alphabetically, it wouldn't make sense.

And imagine if it used [binarySearch](http://googleresearch.blogspot.co.uk/2006/06/extra-extra-rea...) as part of it's implementation? Then `sortAlphabetically` would be broken, and people might waste a lot of energy looking everywhere else instead of just looking at the data and reading the code.

> Imagine a situation where a bunch of constants for an API are defined as such:

Are really all of those definitions helpful?

If I want to search for `/getUser` in a program, I might do `grep -r getUser .` and then learn that I need to repeat that with `grep -r kURLAPIGetUser .` -- was that really better?

If `/getUser` is being used in more than one place, then maybe we should talk about that problem of duplicating effort. If it isn't, then the define is absolutely worthless.

Re:Why I vertically align my code by Dylan16807 on Saturday November 29, 2014 @02:20PM (#8674735)
This is such a subtle problem that countless people implementing binary searches didn't think about it, yet you think reading an unlabeled blob of code will make people notice?
Re:Why I vertically align my code by geocar on Saturday November 29, 2014 @02:49PM (#8674836)
Yes, I think if programmers do not actually read code, they will not notice the bugs in it.

Considering the binary search more deeply, http://comjnl.oxfordjournals.org/content/26/2/154.full.pdf is useful; De Angelos search (family 4) was a successful search, but it contains this bug. Implementations based on families 1 and 2 but perhaps trying to be less clever would not.

Re:Why I vertically align my code by Dylan16807 on Saturday November 29, 2014 @04:38PM (#8675170)
That's not what I asked. Do you think they will find the bugs just because of rereading a standard algorithm?

Having to reread code when trying to accomplish something unrelated seems like a terrible way to seek out bugs.