Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>If I use <code>Class Table Inheritance</code> meaning:</p> <blockquote> <p>one table for Products, storing attributes common to all product types. Then one table per product type, storing attributes specific to that product type. -Bill Karwin</p> </blockquote> <p>Which I like the best of Bill Karwin's Suggestions.. I can kind of foresee one drawback, which I will try to explain how to keep from becoming a problem. </p> <p><strong>What contingency plan should I have in place when an attribute that is only common to 1 type, then becomes common to 2, then 3, etc?</strong></p> <p>For example: (this is just an example, not my real issue)</p> <p>If we sell furniture, we might sell chairs, lamps, sofas, TVs, etc. The TV type might be the only type we carry that has a power consumption. So I would put the <code>power_consumption</code> attribute on the <code>tv_type_table</code>. But then we start to carry Home theater systems which also have a <code>power_consumption</code> property. OK its just one other product so I'll add this field to the <code>stereo_type_table</code> as well since that is probably easiest at this point. But over time as we start to carry more and more electronics, we realize that <code>power_consumption</code> is broad enough that it should be in the <code>main_product_table</code>. What should I do now?</p> <p>Add the field to the <code>main_product_table</code>. Write a script to loop through the electronics and put the correct value from each <code>type_table</code> to the <code>main_product_table</code>. Then drop that column from each <code>type_table</code>.</p> <p>Now If I was always using the same <code>GetProductData</code> class to interact with the database to pull the product info; then if any changes in code now need refactoring, they should be to that Class only.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload