Hi John,
I use a data-driven Strategy table (in conjunction with a data-driven Abstract Factory) to determine which class to instantiate. Both are based on the Abstract Factory by Andy Kramek and Marcia Akins presented in a FoxTalk issue a while back. My code usually ends up looking something like:
Local loItem as aItem of items.vcx, lcItemType
lcItemType = ...
loItem = Strategy("Item", lcItemType)
loItem.DoSomething()
>Hi,
>I am developing Inventory control system. In my design, it should able to manage multiple type of product such as normal item (such as cann food), serialno'ism' item (such as electrical ite, mobile device) and matrix item (such as fashion item, clothes).
>
>For these 3 different type of item, there have different/same attributes for example:
>normal item : SKU, Barcode
>serialno item : SKU, Barcode (may be), serial no, model
>matrix item : SKU, BarCode (different colour/size will have different barcode generated), ColourCode, SizeCode, Model
>
>My question is, how to design classes that able to handle these 3 items (ex. while collecting data, display data, validate data) with same interface without DO CASE ...ENDCASE in all around my UI/Business layer?
>
>I used to think about strategy patttern, however, It still seem DO CASE ...ENCASE is required in UI level while collecting/doisplay data.
>
>Any ideas, or example for similar problems?
>
>Thank you