Re: How would you handle such situation?
Re: How would you handle such situation?
- Subject: Re: How would you handle such situation?
- From: David LeBer <email@hidden>
- Date: Wed, 3 Aug 2005 13:51:42 -0400
On 3-Aug-05, at 12:58 PM, Dev WO wrote:
Hi list,
After trying to figure out the best way to handle the following, I
came up with... nothing.
I have a parent class Product and subclasses
-ProductTypeA
-ProductTypeB
and a couple more types;)
I'd like to display the informations (the shared one (from Product)
like "price", and the specific to a type ones, lets say "speed") of
the product.
I was first thinking about doing a template for each type of
product, but this isn't really good as I would have to update every
template whenever I update one.
So I was thinking about creating one template that would get all
the attributes (with conditionals) and create instance variables
for every attributes and conditionals inside the template component.
Then I wanted to do something like: (pseudo code;))
if object instanceof ProductType1 then
cast object to productType1 variable
set all the attributes and conditionals
I think it could work, but I'm not really sure I'm going the right
direction...
So many times people of the list showed me a lot more simpler and
efficient way to go, so maybe this time again.
Anyone with a point of view?
Personally, I'd probably avoid setting up instance variables unless
you'd see significant performance problems from not.
Since I use ProjectWonder I'd take a look at ERXInstanceOfConditional
and use that in my component.
--
;david
--
David LeBer
Codebase Software Systems
site: http://www.codebase.ca
blog: http://david.codebase.ca
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden