Okay - I'm (finally) going to attempt to create a system using OO principles. I've got (I think) a good understanding of OO concepts but am having trouble converting my thinking.
Specifically I'm having trouble defining for myself "touch points" between the conceptual objects I'm creating and the database that will store the data. As an example, I'm building a scheduling system for large, multi-venue, multi-performer events for use on www.firstnight.org. I've designed my data model (that, it seems, doesn't really change) and now want to design my collaboration model. I'm sure that many of my questions are dense, but here's where I am. Also I'm not having trouble programming any of this - I know I can do all this, but I'm just not sure how to do it "right". ;^) I keep finding myself leaning towards procedural code poorly contained in an object wrapper. Consider that I have an "Artist" object which has properties like "name", "profile", "website", etc. That data is, of course, stored in a database (SQL Server, for what it's worth) table. Here are some of my confusions: 1) How do you (using good OO practices) put the data in the database? Does the "Artist" object have a "SaveData()" method (or somesuch) so that you first instantiate the object, then store the data in the database or do you have another object that stores the data for later? Everything I read talks about instantiating the object with data but nothing details the link between the persistent data store and the transient object. 2) In the same way, when I'm editing the properties of the object does the object normally update the persistent store immediately in the "set()" methods or is there normally a method to do this all in one go - something like a "save()" method? 3) When I present a list of the artists do I (again using best practices) instantiate a structure (or array or whatever) of "Artist" objects (which will contain much more data than my list needs but seems conceptually sound) or do I have some intermediate "ArtistList" object which just outputs a record set? Basically this last one concerns memory usage. I can conceptualize a "Festival" object which contains many "Event" and "Venue" objects which are linked together by "TimeSlot" objects. The "Event" objects would further contain references to "Artist" objects which in turn contain references to "Asset" objects (images, multimedia, etc). Although I can conceptualize how the whole thing, all together, would "feel" and be constructed I'm having trouble conceptualizing how to pull just the needed information from the database. When an end user requests a list of Venues, then selects one to see the events at that venue what gets instantiated? Is it a "VenueList" object or an array of (all) Venue objects? I hope some of this made sense... perhaps it will to me in the morning. It's pretty late here. ;^) Thanks in advance, Jim Davis ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| 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

