Coding Standards SO IRRITATING 
2009.07.16 10:04 - Whining, Work-related
Visual Studio will let you specify an external settings file which can contain a blue million different settings, including coding style bits and pieces. This is probably a good idea, as there's also menu shortcut that lets you reformat whole files on demand, which will make whatever poor soul that winds up responsible for merging branches in your source code repository endlessly happy. (ISTR stumbling across a checkbox somewhere in the application's bowels that let you reformat a file whenever you saved it, but can't find it now. Perhaps that misfeature was removed.)

I'm still irritated that it includes settings for brace style, and that they're all wrong0. The only thing I find more irritating than having the Wrong Brace Style1 foisted on me for no good reason is having a SQL query I've already written completely reformatted because the other developer couldn't figure out how to make an isolated change without running the whole thing through some code generator.2

And if you think that this seems petty, trivial, and boring ... well, I never promised anything.

Footnotes
0. Where 'wrong' is defined as 'not the way I do things'. I just can't put every brace and flow-control keyword on a separate line. It's pointless. It makes an if-else-if-else construction take up four extra lines that say nothing. It's like inserting dramatic pauses into a reading of a grocery list.
Me Them
if (foo) {
    blah;
} else if (bar) {
    blah++;
} else {
    baz;
}
if(foo)
{
    blah;
}
else if(bar)
{
    blah++;
}
else
{
    baz;
}
Anyway, I hate it.
1. Where, again, wrong == !mine.
2. It's usually painfully obvious, too, because I use a somewhat verbose formatting style in SQL:
Me Them (often, not always)
select
    f.foo_bar,
    f.foo_baz,
    b.bar_foo,
    b.bar_baz
    from
        foo f
        inner join bar b
            on      f.foo_id = b.foo_id
                and f.blah = 'MAGIC_NUM'
    where
            f.foo_id = 1
        and b.bar_id = 2
        -- or whatever
SELECT F.FOO_BAR, F.FOO_BAZ, B.BAR_FOO,
    B.BAR_BAZ
FROM FOO F INNER JOIN BAR B ON F.FOO_ID
    = B.FOO_ID AND F.BLAH = 'MAGIC_NUM'
WHERE F.FOO_ID = 1 AND B.BAR_ID = 2
It's certainly more compact, but God help you trying to read anything non-trivial that's formatted like that. It's worse if they've done it by hand, so that the indentation is both inconsistent and achieved with a combination of spaces and tabs.

  |  [ 0 trackbacks ]   |  permalink

Back