> -----Original Message----- > From: Sean A Corfield [mailto:[EMAIL PROTECTED] > Sent: Friday, September 19, 2003 9:15 PM > To: CF-Talk > Subject: Re: Yet another OO/CFC question > > On Friday, Sep 19, 2003, at 16:56 US/Pacific, Hal Helms wrote: > > 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. > > Actually I think Jim's problem is one of modeling: he has "Venue" but > really that is modeling two things... a physical location (e.g., > "Boston Common") and the actual performance rooms within it (e.g., > "Frog Pond", "Brewer's Fountain" etc). If you separate out these two > concepts as Venue and PerformanceRoom then a Venue always has at least > one PerformanceRoom. Both entities have their own useful properties: a > Venue has various facilities, a PerformanceRoom has seating / standing > capacities etc.
I had considered that but the physical model isn't so clean: 1) Many (in fact most) venues are simply venues: "Arlington Street Church" is simply that. I could bend it to be a parent/child relationship, but it doesn't really work. 2) Some events are linked to the whole Venue, others to rooms within that venue. For example "Jugglers" appear throughout the Hynes Convention Center but "Noisemaker workshop" is only in the North Hall at Hynes Convention Center. 3) Each "Venue" correlates to a "MapID" (a numeric indicator on a map given to participants). Most are small, single room affairs but a few are very large and have many locations within them - namely in at least one case three levels deep. It's this last one that concerns me most about your suggestion. Although for my immediate needs two level (Venue: room) would work it limits things to two levels. The data model is n-deep - I want the object model to mirror that. Of course nearly all my big problems are "fringe" ones. Out of 80 or so venues only three have this problem. ;^) My hope is to (someday) spin this application off. For something like a convention it's easy to imagine more than two level. For example a technical conference might have a map of the hotel, a pointer to a suite and then rooms within that suite. The n-deep model allows us to contain the suite in the hotel and the rooms in the suite so that upon command we can display all those activities taking place at the suite. I also have to model an n-deep attribute tree (categories, attributes, lists, etc) so I'll have the same issue to face there in any case. > Yes, there are some cases where a genuine null would be a big help (and > I've requested it too) but by examining the multiplicity in OO > relationships you can usually workaround it in a fairly clean way. The > hardest thing to work around is "0 or 1" for which you pretty much have > to use isDefined() or structKeyExists()... Right now I think that I'm going to kludge to a special "root" venue. Looping routines will have to know to "stop at root" so that I can keep the return type as "venue". I don't know tho' - I've changed my mind three or four times in the past two hours... maybe I need to sleep on it. ;^) I definitely like the idea of a "real" null. But it seems like this problem is specifically related to the returntype and cfargument type - it's difficult to set them to custom classes AND make them optional. I'm not sure if you have to take the (I presume drastic) step of allowing "null" everywhere in CF - but perhaps allowing, for these cases, a special "Undefined" value (a la JavaScript) might be nice. Perhaps a function, Undefined(), that returns a value capable of being passed in these cases but actually containing no value. So if "myVenue.setParent()" requires an object of type "Venue" I could legally do: myVenue.setParent(Undefined()) A "TypeOf()" function that returns either the Component type or the same Undefined() value may also be nice. As in <cfif TypeOf(myVenue.getParent()) NEQ Undefined()> or <cfif TypeOf(myVenue.getParent()) EQ "Venue"> That's of the top of my head so it may flakey (get it! Flakes from the top of my head! HA!) Jeeze it's late. Jim Davis ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Message: http://www.houseoffusion.com/lists.cfm?link=i:4:137787 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 This list and all House of Fusion resources hosted by CFHosting.com. The place for dependable ColdFusion Hosting. http://www.cfhosting.com

