Taking your example a step farther, lets assume that the determined logic is
that the method's will automatically save it once a minimum amount of
correct information is set.  How would you maintain the object's state?
Through either session or user variables?  Using fields instead of objects,
one could just used hidden fields to pass the information from page to page.

-----Original Message-----
From: Raymond Camden [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, February 04, 2003 9:21 AM
To: CF-Talk
Subject: RE: CFC set's & get's


You don't _have_ to do anything really. It depends on what makes sense
for you. Here is just one example:

Article.cfc

Article has a method, load, that accepts an ID as an argument. This will
read from the db and set info in the CFC instance like title, body, etc.

Article has methods to set title, body, etc. Now, for each of these, you
could set it up so that each time you set a property, you update the
database. You may instead decide to have a method, save, that will
update everything at once. If you need to set a lot of properties, this
would probably be a bit quicker. You could also ensure that everything
is set right. (For example, maybe someone only set title, but not body,
and you would not want partial data in the db.)

Again, though, you need to do what makes sense for your app. This is
just an example.

=======================================================================
Raymond Camden, ColdFusion Jedi Master for Mindseye, Inc

Email    : [EMAIL PROTECTED]
WWW      : www.camdenfamily.com/morpheus
Yahoo IM : morpheus

"My ally is the Force, and a powerful ally it is." - Yoda

> -----Original Message-----
> From: Andy Ousterhout [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, February 04, 2003 9:12 AM
> To: CF-Talk
> Subject: CFC set's & get's
>
>
> Do you put the database selects & updates/inserts and the
> logic on when to save/read into the set's  & gets or do you
> have separate methods for reading & writing to/from the database?
>
> Andy
>
>
>

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

                                Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
                                

Reply via email to