I just wanted to thank everybody for all the discussion on this subject.
Its certainly been enlightening.  I would have to say that one of the
better solutions to the problem given was that my carDAO should actually
return an object of the correct subclass.  So if the database says its a
truck then it returns a truck object.  However, the solution I'm leaning
towards is not actually having Truck, SUV, Sportcar subclasses.  As someone
suggested, not just a truck can tow a boat so its really a method all cars
have just some cars do it better than others and for some cars like
sportscars that don't have a hitch so calling the towboat method would
throw an error or return some appropriate response like "I can't".  I think
the best solution for my particular situation involves not having
subclasses but rather having descriptions of cars based on attributes.
car.amIaTruck() would return true if it has a bed, a hitch and a gun rack.
I shouldn't be trying to figure out whether or not myCar can tow a boat, I
should ask myCar whether or not it can tow a boat and it can figure it out
itself.


Thanks again for all the ideas

Jason Cronk
[EMAIL PROTECTED]




----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email to 
[email protected] with the words 'unsubscribe cfcdev' as the subject of the 
email.

CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting 
(www.cfxhosting.com).

An archive of the CFCDev list is available at
www.mail-archive.com/[email protected]


Reply via email to