Jim,

The problem you're running into is why we so urgently need for CF to
have the concept of "null" - a symbol that fulfills the contract for any
class. Without that, you're going to have to find some kludge to prevent
against run-time errors if you have a returntype attribute enabled. As
for the right kludge, I don't think it much matters which one you
choose.

Hal Helms
See halhelms.com for classes in...
Java for ColdFusion Programmers
Fusebox 4
Mach-II
OO Applications with CFCs

-----Original Message-----
From: Jim Davis [mailto:[EMAIL PROTECTED] 
Sent: Friday, September 19, 2003 4:43 PM
To: CF-Talk
Subject: Yet another OO/CFC question


This one's probably simple but my brain doesn't want to handle it.

I've got a "Venue" CFC that contains information about
performance/exhibit areas.  Some venues feature many rooms or areas. For
example Boston Common has the Frog Pond, the Brewer's Fountain, and the
Bandstand; the Boston Ballet building has 5 studios; etc

The net result is that each venue may have a single parent and may have
many children.  I'm an old hand at using "parent"/"child" processing in
SQL but am unclear how to model this in a CFC.

My first assumption was that the Venue component would have a "Parent"
property of type "Venue".  My problem occurs when a venue doesn't have a
component.  When I'm writing my "getter" I'm not sure how to handle the
returntype.

Most simple types are defaulted to the empty string - what of 

How would this normally be done?  Would you:

1) Populate the "Parent" property with a Venue object if needed, but
leave it as the empty string if not?  And then use something like "NOT
IsSimpleValue()" to determine if it's populated?

2) Populate the "Parent" property with a Venue object if needed, but
leave it UNDEFINED if not.

3) Create another property as a "gatekeeper" for this one; something
like "isChild" populated with a Boolean value?

4) Always populate the property using either a real parent or a
self-reference (in effect saying "when I'm my own dad, we're at the
top")?

5) Populate the property with an "empty venue" (one that's instantiated
but not populated)?

6) Something else entirely?

My goal, of course, is to access the object as seamlessly as possible
(having external object do a lot of "checking" on the return doesn't
seem very clean).

I guess, to make it simple, I'm asking how to best deal with optional
custom datatypes.

Thanks in advance.

Jim Davis



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Message: http://www.houseoffusion.com/lists.cfm?link=i:4:137780
Archives: http://www.houseoffusion.com/lists.cfm?link=t:4
Subscription: http://www.houseoffusion.com/lists.cfm?link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Signup for the Fusion Authority news alert and keep up with the latest news in 
ColdFusion and related topics. 
http://www.fusionauthority.com/signup.cfm

Reply via email to