A design Q

From: Date: Sun, 25 Jun 2000 16:48:23 +0000
Subject: A design Q
Groups: php.general 
Request: Send a blank email to php-general+get-3004@lists.php.net to get a copy of this message
Hi, It's Sunday I know :). 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). But,AFAIK, link attributes are coded as attributes in one of the two classes. Graphically that would look like: [-- Product --] [-- Cart --] | name:string |---+---<>| items:hash | | ... | | +------------+ +-------------+ id | <op>Item() | | get<Attr>() | +------------+ | set<Attr>() | +-------------+ So, where should id go to? To Product (as an attribute) or to Cart (as a key in the hash) ? Or how should I choose a good key? [currently md5(serialize(<product>))] Any ideas welcome. -- teodor

« previous php.general (#3004) next »