The set method for address would typically 'set' the variable within the instance of the bean. The 'update' or 'create' methods are generally called from within a service layer or gateway, which in turn converts any data as necessary, populates a bean instance, validates that instance, and then runs the respective method from the DAO to actually populate or update the db.
A word on validation. Say you have a method to 'set' an email address (or phone number, or social security number). Your 'set' method will be very simple, populating the variable within the bean instance only, while varifying it to be of the proper variable type (string, numeric, etc.) by using the 'type' attribute of cfargument. The validate() function of a bean is kind of a pre-processing function, used to do things like server side validation of an email address, or remove dashes from a phone number while insuring that it's the correct length. Verifying that all vars contain an accepted value for those db fields that don't allow nulls. Cutter _________ http://blog.cutterscrossing.com Andy Matthews wrote: > In a set method for address (for example), that doesn't actually update the > database does it? It simply changes the value stored in the session var or > something? > > <!----------------//------ > andy matthews > web developer > certified advanced coldfusion programmer > ICGLink, Inc. > [EMAIL PROTECTED] > 615.370.1530 x737 > --------------//---------> > > -----Original Message----- > From: Steve Brownlee [mailto:[EMAIL PROTECTED] > Sent: Wednesday, May 17, 2006 11:16 AM > To: CF-Talk > Subject: RE: OOD/Design Patterns and ColdFusion. > > > 1. Validation > 2. Encapsulation > 3. It just makes so much darned sense, don't it? > > For many web app developers, classes (or beans in this discussion) are > code representations of database objects and so must perform the > function of getting data from, or putting data into, those database > fields. Keep in mind one of the basic tenets of OOP: encapsulation. > Encapsulation is done in the hopes of preventing us silly, little humans > from messing up our data by adding more rules and processing than is > necessary. > > If you have one get/set for each attribute, then the code for those > methods are ridiculously straightforward and very hard to mess us. If > you, however, have one method to accept all attributes in some sort of > delimited format, then the rules becoming much more complex and the > chance for bugs and bad data increase exponentionally (just a figure of > speech, I have no proof that it is exponential). > > > Steve "The Boss" Brownlee > http://www.orbwave.com/cfjboss > > > -----Original Message----- > From: Andy Matthews [mailto:[EMAIL PROTECTED] > Sent: Wednesday, May 17, 2006 10:09 AM > To: CF-Talk > Subject: RE: OOD/Design Patterns and ColdFusion. > > Steve... > > I do have one comment/question about your example. It seems to be a > little excessive to have a get and set method for each individual column > in a database. Can you explain the reasoning behind this? > > <!----------------//------ > andy matthews > web developer > certified advanced coldfusion programmer ICGLink, Inc. > [EMAIL PROTECTED] > 615.370.1530 x737 > --------------//---------> > > > > > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Message: http://www.houseoffusion.com/lists.cfm/link=i:4:240784 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

