Justtechjobs.com Find a programming school near you






Online Campus Both


php-general | 2000071

Re: [PHP] Re: [PHP-GENERAL] A design Q From: Teodor Cimpoesu (teo <email protected>)
Date: 07/01/00

Hi Richard!
On Fri, 30 Jun 2000, Richard Lynch wrote:
> > I am prototyping a Cart, and I am not decided where should
> > I put the `Product ID'. From a design point of view it's a
> > link attribute (it has a meaning only in the relation Product->Cart,
> > which is an agregation, so I'll have an internal hash for this).
>
> If *I* was doing this, I'd have three tables: Products, Carts, and Shopping
>
> Carts would pretty much just be an ID generator, so in some SQLs, it would
> just be a sequence, not a table. In MySQL, you're stuck with a table with
> an auto-increment, I think.
Oh, I was talking about classes. So far I am not concerned with any tables.
All the needed data is provided through a wrapper function.

I am seduced by the Model-View-Controller pattern (aka Model 2 in JSP)
so this was an object not DB design question.
I ended in having only 2 classes for the Model : Product and Cart
and a CartView for the View.

The Q was on Product and Cart classes, which one should keep the
product id (aka SKU).Going back to my OMT knowledge I chose it to
be in the Cart :)

Thanks for answering though.

-- teodor

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-general-unsubscribe <email protected>
For additional commands, e-mail: php-general-help <email protected>
To contact the list administrators, e-mail: php-list-admin <email protected>