• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: How would you handle such situation?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: How would you handle such situation?
      • From: Dev WO <email@hidden>
References: 
 >How would you handle such situation? (From: Dev WO <email@hidden>)

  • Prev by Date: Re: Build & Run Issue
  • Next by Date: Re: How would you handle such situation?
  • Previous by thread: How would you handle such situation?
  • Next by thread: Re: How would you handle such situation?
  • Index(es):
    • Date
    • Thread