POV-Ray : Newsgroups : povray.off-topic : The code I'm working on makes me want to cry ... : Re: The code I'm working on makes me want to cry ... Server Time
5 Sep 2024 11:22:58 EDT (-0400)
  Re: The code I'm working on makes me want to cry ...  
From: clipka
Date: 6 Aug 2009 16:38:22
Message: <4a7b3f3e$1@news.povray.org>
Mike Raiford schrieb:
> Control ctrl = (Control)sender;
> 
> switch (ctrl.Name)
> {
> case "cboCustomer":
> .
> .
> .
> 
> 
> Seriously, WTF? There's 2 events like this... I could have been 
> mistaken, but I thought the great advantage of events and such was to 
> avoid switch statements, or long if...else... blocks.

Is that C# code?
Then it's probably just one more case of grown code, such as:

- Events X from control A and Y from control B must trigger the same 
action, so we'll just route them to the same code.

- Hey folks, we need to do some extra action when X is raised by A; make 
sure you get this up and running before the next release... oh, and that 
would happen to be in two hours' time, so you better skip your lunch 
break today.

- Duh, no lunch today? That's bad. Let's see how we can fix this with as 
little time effort as possible...


That's what happens when people aren't given enough time (or are too 
lazy) to refactor their code now and then.


> Oh, and get this... the database is just as delightful. The customer's 
> address information is in..... 3 tables.
> 
> 1 the main table contains the address itself, and pointers to the city, 
> and the state tables.
> 
> That's right, a row for every city, and a row for every state.

That doesn't sound particularly WTF'ish to me. Unless, of course, the 
city and state tables contain one row for each customer (in that case: 
Good thinking on the part of the database designer, but probably bad 
communication with the guys who implemented the application) or use the 
city / state name as their primary key and only data column...


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.