is this an appropriate subclass?
Posted on 2004-03-23
I am building an ECommerce application.
What i need to do is to 'counter sell', for example if you go into a shoe store, normally at the counter, the sales attendant will try to sell you shoe polish, laces, a shoe horn etc. Thats what I need to do on the site.
One part of the datebase has this structure:
two tables, tblAccessoryProduct and tblProduct
For every Product field(e.g. the shoe) there can be many AccessoryProduct fields (e.g. the laces, or the shoe polish)
The Product table holds the usual stuff, ProductID, product name, price, short description, long description, RRP etc.
The AccessoryProduct table only has 3 columns.
ProductID //this is the main product. i.e. the ProductID of the shoe
AccessoryProductID //This is the ProductID of the shoe polish, the data for which is held in the Product table, like all the other products
AccessoryProductDescription // this is a field to hold a description specific to this relationship e.g.In this example "Remember the tan shoe polish to use especially for your Dr Martin boots."
The question (finally) is :
Should AccessoryProduct be implemented as a subclass of my Product Object, or should it be an object on its own. In essence AccessoryProduct is a Product, but is has an association with another specific product as well as a description.
What say you?
Thanks in advance..