Click here to Skip to main content
15,903,175 members

The Weird and The Wonderful

   

The Weird and The Wonderful forum is a place to post Coding Horrors, Worst Practices, and the occasional flash of brilliance.

We all come across code that simply boggles the mind. Lazy kludges, embarrassing mistakes, horrid workarounds and developers just not quite getting it. And then somedays we come across - or write - the truly sublime.

Post your Best, your worst, and your most interesting. But please - no programming questions . This forum is purely for amusement and discussions on code snippets. All actual programming questions will be removed.

 
GeneralRe: 9000 lines of ... Pin
CDP180222-Feb-12 4:35
CDP180222-Feb-12 4:35 
GeneralRe: 9000 lines of ... Pin
JackDingler28-Feb-12 5:18
JackDingler28-Feb-12 5:18 
GeneralRe: 9000 lines of ... Pin
theMadCoder7-Mar-12 4:24
theMadCoder7-Mar-12 4:24 
GeneralRe: 9000 lines of ... Pin
ekolis22-Feb-12 7:15
ekolis22-Feb-12 7:15 
GeneralRe: 9000 lines of ... Pin
Stefan_Lang22-Feb-12 3:48
Stefan_Lang22-Feb-12 3:48 
GeneralRe: 9000 lines of ... Pin
CDP180222-Feb-12 4:22
CDP180222-Feb-12 4:22 
GeneralRe: 9000 lines of ... Pin
ekolis22-Feb-12 7:18
ekolis22-Feb-12 7:18 
GeneralRe: 9000 lines of ... Pin
CDP180222-Feb-12 11:38
CDP180222-Feb-12 11:38 
Perhaps that's perfectly normal on some obscure planet where he comes from.

It rally truned out that he casually binds the dataset to a report before saving, so that you can print that out. The columns are added or removed according to the user's role and are perhaps added again after opening the report. Ahh, yes, he had to fill the some values into the newly added columns. He only does that in the first rows of the tables and ignores all others. That's also a common pattern in one of his other creations. He always assumes that datatables are filled with exactly one row, no more, no less. Anyway, he must have discovered that he needed an XML schema of the dataset, so he simply saves it after finishing his manipulation. Great idea. This way the schema is always accurate, no matter which route we took through the spaghetti code.

My best guess is that the report was added later and that he needed two or three slightly different reports, depending on the user's role. Anybody exept him would have clicked together a schema, created a typed dataset from it and added different queries to fill it for the different roles. Filling and binding it would have been something around 15 lines of code.

But don't worry too much about the database. Not a single table had a primary key and of course no foreign keys or other constraints. Why should he need them since he apparently believes that his queries always return exactly one row? I would not put it beyond him to simply reverse his manipulations in the dataset before saving. I honestly will not look if I don't have to.
I'm invincible, I can't be vinced



Generalreviewing old code Pin
0bx16-Feb-12 4:28
0bx16-Feb-12 4:28 
GeneralRe: reviewing old code Pin
BobJanova16-Feb-12 5:19
BobJanova16-Feb-12 5:19 
GeneralRe: reviewing old code Pin
0bx16-Feb-12 6:33
0bx16-Feb-12 6:33 
GeneralRe: reviewing old code Pin
ekolis16-Feb-12 14:12
ekolis16-Feb-12 14:12 
GeneralRe: reviewing old code Pin
0bx16-Feb-12 23:10
0bx16-Feb-12 23:10 
GeneralRe: reviewing old code Pin
Stefan_Lang17-Feb-12 1:55
Stefan_Lang17-Feb-12 1:55 
GeneralRe: reviewing old code Pin
AspDotNetDev16-Feb-12 14:28
protectorAspDotNetDev16-Feb-12 14:28 
GeneralRe: reviewing old code Pin
0bx16-Feb-12 23:01
0bx16-Feb-12 23:01 
GeneralRe: reviewing old code Pin
AspDotNetDev17-Feb-12 7:04
protectorAspDotNetDev17-Feb-12 7:04 
GeneralRe: reviewing old code Pin
TorstenFrings16-Feb-12 23:21
TorstenFrings16-Feb-12 23:21 
GeneralRe: reviewing old code Pin
Nagy Vilmos17-Feb-12 0:28
professionalNagy Vilmos17-Feb-12 0:28 
GeneralRe: reviewing old code Pin
0bx17-Feb-12 5:29
0bx17-Feb-12 5:29 
GeneralRe: reviewing old code Pin
Francis W. Porretto17-Feb-12 0:54
Francis W. Porretto17-Feb-12 0:54 
GeneralRe: reviewing old code Pin
Robert Heffernan17-Feb-12 0:55
Robert Heffernan17-Feb-12 0:55 
GeneralRe: reviewing old code Pin
PIEBALDconsult17-Feb-12 2:34
mvePIEBALDconsult17-Feb-12 2:34 
GeneralRe: reviewing old code Pin
Harley L. Pebley17-Feb-12 5:43
Harley L. Pebley17-Feb-12 5:43 
GeneralRe: reviewing old code Pin
englebart20-Feb-12 4:38
professionalenglebart20-Feb-12 4:38 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.