Otte: staring into the abyss
Posted Aug 4, 2012 16:45 UTC (Sat) by
jzbiciak (
✭ supporter ✭, #5246)
In reply to:
Otte: staring into the abyss by nix
Parent article:
Otte: staring into the abyss
Actually, I find your compressed whitespace version harder to follow, probably because I'm in the habit of moving my eyes between columns and working fields in groups. I'll read a few field names (as in 2 to 4), then jump to the column of values, then back to the column of field names, etc. That is to say, my visual scanning is roughly like this:
stic->phase
stic->next_phase
stic->fifo_ptr
...followed by...
= 0;
= 57;
= 0;
All three values are centered together in the highest-res portion of my vision. That doesn't work as well when the second target is more like:
= 0;
XXXXX = 57;
XXX = 0;
If it makes sense to do so, I'll even insert a blank line to make the grouping more obvious, or use different horizontal columns for the values in the groups, if the groups are more logically separate.
If I always scanned field name by field name one at a time, it'd be a problem. But since I tend to bunch fields in logical groups, and tend to treat them as groups, it's actually easier for me to follow when I can see all the field names simultaneously, and then see all the field values simultaneously. My brain can remember field order for a handful of fields at a time, and so treating them in groups goes much faster for me.
Now, in C++, where all those fields would be constructor arguments instead, I'd probably group them differently. In any case, I try to group things to that my innate visual sense of "alike" and "different" help me spot anomalies.
In your compressed version, I have to play "find the value", and I forget what value I'm looking for after awhile. I'm forced to read field-by-field, which is much slower for me. I'm /less/ likely to find unintended discrepancies.
I guess it's the same reason I write "max" with this idiom:
if (max < val)
max = val;
It's easier to see I've hooked everything up properly if I can read down the columns and everything reads in the same order in each column.
BTW, on the tabs thing: I've got a strict no-tabs policy in our team, and we set indentations at 4. It's easily enforced so far, though, because there's no more than a few of us at any given time. We're attached to a chip design team, so there's no danger of us suddenly growing our software team...
(
Log in to post comments)