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
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
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;
}
|
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
|
| [ 0 trackbacks ] | permalink
2009.06.19 14:36 - Work-related
1500-ish lines of C# for a single class which contains 20-odd static member variables and less than 10 instance variables. Functions which take no parameters, return void, and set one of those globals. The global will never be checked for null, the code is not organized so that it can be read in anything like an expected order (the variable is accessed and used in 2 functions around line 250, but set at line 500-something), and variables do not tend to follow guidelines about descriptive names. At least the set function is static. (Of course, so's another function that takes an instance of the class as an argument ...)
I don't know. Maybe I'm the one that's out in the weeds here, and this is actually brilliantly optimized design. I kinda doubt it, though.
| [ 0 trackbacks ] | permalink
2009.05.26 16:02 - Work-related
I think it just took me the better part of four hours to clean up some code to a state that was readable enough to begin puzzling out how it has to be changed to accommodate our ever-changing system requirements.
I am pretty sure this is just some basic furniture moving (i. e. "A little to the left, a little more ... on second though, put it back in the corner where it was. No, a little more to the right, etc."), but they've gone and changed the jargon surrounding this feature in the two years between when this code was probably written and now, when they've decided that maybe they'd actually like to use it. This complicates an already baroque implementation of a confused feature.
Anyway, I'm a bit frazzled, now.
| [ 0 trackbacks ] | permalink
Back Next





