Skip to content

Comment on Source Code Typography

Comments

Looking at this thread is why we need tools that let us structure code the way "WE" like it, but that outputs said code in a defaulted format.

Basically IDE formatting should be outside of the actual code formatting allowing people to format code how they see fit. Some are going to like to see the code the "standards" way and that's fine; Many of us will not.

@tmoertel's point is a prime example of this, as the only relationship I personally see in the aligned code is that they are all variables. His perceived parallelism was not present in my personal view of that same code snippet. Now for me white-space denotes parallelism more poignantly than alignment.

  var  x                  = shape.left(),
         y                  = shape.right(),
                                                           <--**
         numSides = shape.sides();
meh, I give up trying to format this code block. :P

*This denotes parallels between variables to me. Not the alignment.

The only parallel that is draw for me is that all the items are variables (this would also be reinforced by the color I give variables). I group things with white-space; so that means in the context of the function using the variables as I've laid them out above; x,y are related and most likely linked, where numSides is needed but not necessarily associated inside the function with the x,y variables.

So ya, this stuff is very subjective and as @tmoertel said "subtle and tricky".

O.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.