Other People Should Make My Life Easier 
2010.08.27 09:29 - Entertainment, Microcode, Whining, Work-related
I'd like to be able to do something like this
try {
    /* and then, a miracle occurs! */
} catch (BarException beFoo => String.Equals(be.Property, "Foo")) {
    // foo handler
} catch (BarException beBar => String.Equal(be.Property, "Bar")) {
    // bar handler
} catch (BarException be) {
    // general BarException handler
}
Mostly because it seems slightly cleaner than the current approach to handling, e. g., OracleExceptions, where one might care about some of the error codes represented by the exception, but not all of them:
try {
    /* and then, a miracle occurs! */
} catch (BarException be) {
    if (String.Equals(be.Property, "Foo")) {
    // foo handler
    } else if (String.Equals(be.Property, "Bar")) {
    // bar handler
    } else {
    // general BarException handler
    }
}
Some flexibility is lost vs. using if-else statements instead, but you could produce the same thing with typeof and nobody sane does that if they can get out of it, either. Semantically, it's pretty much equivalent and, syntactically, it's more verbose (to no obvious semantic advantage), so I'm sure it's not actually a good idea. (Additional evidence it's a bad idea: I'm sure I'm not the first to hit on this idea, yet it isn't implement in C# as far as I can tell. Presumably, those guys know what they're doing.)

Granted, it would be even better if Oracle would throw different exception types for different error codes instead of throwing the one type with slightly different data, but some problems seem, prima facie, less intractable than others.
  |  [ 0 trackbacks ]   |  permalink
Well, it's been such a nice day so far... 
2010.02.08 21:25 - Meatspace Stupidity, Whining, Work-related
Discovered some considerate jerk had taken out my passenger-side taillight when walked out to the car to drive to work. No note or anything that I noticed, so somebody's a real class act. I drove to work fairly angry, and discovered as I was parking that I'd left my access card on the dresser. Awesome! Since I wasn't in a mood to turn around and retrieve it, I signed myself in, and resolved to pick it up over lunch, which I did do.

Managed to return a bug ticket as a non-bug (testers: read your documentation!), and managed negative productivity the entire rest of the day, without any great input on my own part. A ticket that was in peer review was returned for minor revisions (no worries), then wound up being shelved for discussion that will probably involve a near-complete rewrite. Yay! It only took a week and 16 pages the first time, so I'm sure it won't be too big a pain the second time. (Do I have a dripping sarcasm tag? No?)

I was able to get an insurance claim filed, and will be stopping at the local PD to file a police report covering the damage, because I can't do that over the phone.

I was doing better while I was sleeping through the clock radio playing the classical music station ...
  |  [ 0 trackbacks ]   |  permalink
Once in a While, I Think About Playing In Traffic 
2009.08.04 10:23 - Whining, Work-related
300+ character regular expression that can be obviated by a single call to DateTime.TryParse().

What the heck. Maybe there's some business requirement requiring a specific set of date formats be supported, but, hey, DateTime.TryParseExact() will cover that scenario. At least it's old code, so there's some hope that we'll have learned from this somewhere in the last two years.
  |  [ 0 trackbacks ]   |  permalink
This is something I hate 
2009.07.21 09:13 - Whining, Work-related
Was handed half-finished application yesterday afternoon. Seems like it ought to be a very straightforward thing: if it were a console app, I could probably pull it off in less than 1K lines of code.

So, of course, it's got a GUI and at least twice or three times that much code already written and it doesn't do anything yet.

[Addendum: Possibly the best part are the weird bits of code that are either an indication that the coder doesn't fully understand the ins and outs of the language, or that there is some very weird and stupid business logic laying around.]

[Addendum Addendum: Looks like I'm overreacting a little. I think I should be able to get where I need to go with this by the end of the week, especially now that I've cleaned most of it up.]
  |  [ 0 trackbacks ]   |  permalink
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 Next