Click here to Skip to main content
15,895,799 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: A piece of ... Art Pin
CARPETBURNER17-Jun-09 22:04
CARPETBURNER17-Jun-09 22:04 
GeneralRe: A piece of ... Art Pin
Jeroen De Dauw22-Jun-09 5:28
Jeroen De Dauw22-Jun-09 5:28 
GeneralRe: A piece of ... Art Pin
Keith Barrow19-Jun-09 13:54
professionalKeith Barrow19-Jun-09 13:54 
GeneralRe: A piece of ... Art Pin
costas081122-Jun-09 10:05
costas081122-Jun-09 10:05 
AnswerRe: A piece of ... Art Pin
Jeremy Tierman22-Jun-09 15:16
Jeremy Tierman22-Jun-09 15:16 
GeneralRe: A piece of ... Art Pin
ssiegel22-Jun-09 14:29
ssiegel22-Jun-09 14:29 
GeneralRe: A piece of ... Art Pin
Kelly Herald30-Jun-09 13:10
Kelly Herald30-Jun-09 13:10 
GeneralRe: A piece of ... Art Pin
puromtec117-Jul-09 17:37
puromtec117-Jul-09 17:37 
This table design could be used to reduce the size of a database and improve manageability that contains unknown/highly dynamic structures

I will make an assumption (the only one in this post) and say this project deals with loading structures that change frequently. Could be wrong and be looking at a noob's 'work of art'

There are three approaches for highly dynamic structural data:

1. Dynamically create the schema's based on external blue-prints, giving real names to columns. This might not be the best solution for a few subtle reasons which have to do with the degree of knowledge by the end-user's of the database and any planned api's or DAL's. Generating the dynamic schema prior to loading data can be done in two modes: 1. immediately, where new un-generated schemas are encountered and have to be generated on the spot. This presents an obvious problem if you have multiple clients performing the imports for a single database (similar to SETI). Such as, what if two clients encounter the same type of schema that isn't in the database yet, only one schema should be generated. 2. Delayed, where after loading many imports and discovering that some new files failed to match any current dynamic schema, the database user can manually kick off schema generation and then attempt a reload of those files that failed earlier.

2. Contain the all the data into a single table (or a table for each datatype) with four columns (ImportFileId, RowId[original structure's], ParameterName, ParameterValue). This solution gobbles up WAY MORE disk space (more than doubles the space requirement of the solution given above as well as in #1 (In oracle, at least, the remaining columns that are null take up no space.) This is considered serializing the data, also could be called demuxing.

3. Then there is the solution above. The only requirement is that any API must map the ImportFileId to some blue-print of the columns involved. This solution saves much more space than #2 AND has the added benefit of simplicity on the database up-keep side (ie. no schema generation prior to import)

I've been down this road dealing with a database with over 400,000 actual unique fields of data. We actually used option #1 for good reason. So, I wouldn't knock it just because it's different.
GeneralFrom the C# forum Pin
Mirko198016-Jun-09 21:43
Mirko198016-Jun-09 21:43 
GeneralRe: From the C# forum Pin
OriginalGriff16-Jun-09 22:39
mveOriginalGriff16-Jun-09 22:39 
GeneralRe: From the C# forum Pin
Fatbuddha 116-Jun-09 22:40
Fatbuddha 116-Jun-09 22:40 
GeneralRe: From the C# forum Pin
Vasudevan Deepak Kumar17-Jun-09 1:11
Vasudevan Deepak Kumar17-Jun-09 1:11 
GeneralRe: From the C# forum [modified] Pin
Dan Neely17-Jun-09 2:20
Dan Neely17-Jun-09 2:20 
GeneralRe: From the C# forum Pin
PIEBALDconsult17-Jun-09 8:39
mvePIEBALDconsult17-Jun-09 8:39 
GeneralRe: From the C# forum Pin
Mirko198017-Jun-09 21:51
Mirko198017-Jun-09 21:51 
GeneralRe: From the C# forum Pin
akyriako7817-Jun-09 3:38
akyriako7817-Jun-09 3:38 
GeneralRe: From the C# forum Pin
Lutosław17-Jun-09 7:57
Lutosław17-Jun-09 7:57 
GeneralRe: From the C# forum Pin
User 274316217-Jun-09 21:24
User 274316217-Jun-09 21:24 
GeneralRe: From the C# forum Pin
cybertone18-Jun-09 20:02
cybertone18-Jun-09 20:02 
GeneralExceptional coding PinPopular
Judah Gabriel Himango3-Jun-09 4:18
sponsorJudah Gabriel Himango3-Jun-09 4:18 
GeneralRe: Exceptional coding Pin
Single Step Debugger3-Jun-09 4:45
Single Step Debugger3-Jun-09 4:45 
GeneralRe: Exceptional coding Pin
jan larsen7-Aug-09 3:02
jan larsen7-Aug-09 3:02 
JokeRe: Exceptional coding PinPopular
Paulo Zemek3-Jun-09 10:17
mvaPaulo Zemek3-Jun-09 10:17 
GeneralRe: Exceptional coding Pin
Moim Hossain16-Jun-09 4:09
Moim Hossain16-Jun-09 4:09 
JokeRe: Exceptional coding Pin
Michael Dunn3-Jun-09 15:57
sitebuilderMichael Dunn3-Jun-09 15:57 

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.