That makes sense, and I understand it much better now. The reason I began reading through the archives was to research in order to better understand your post concerning BOs and DTOs relating to my question about the modelCFC. BOs are objects like person, address, warrant, etc. Basic mechanisms for encapsulating instance data and passing it around. DTOs are Data Transfer Objects used to persist data? Am I reading that correctly?
Thanks again, Justin -----Original Message----- From: Barney Boisvert [mailto:[EMAIL PROTECTED] Sent: Wednesday, October 15, 2003 6:56 PM To: [EMAIL PROTECTED] Subject: RE: [CFCDev] Memento As I understand it, that's not really what the Memento pattern is designed for, though it can be used that way. If you want to serialize an object, then you need a serialization framework that addresses issues such as nested objects and such. The Memento pattern is designed to do allow an object to take a snapshot of it's state for other objects to keep track of. While it is exporting state (generally bad), the idea is that the state is packaged in such a way that no one but the originating object can read it. I'm not sure how to go about that with CF. One example of the Memento pattern in action is an undo function. (This is lifted from the Gang of Four, which I happend to flip through a couple days back.) Say you have a simple editing application. You have the application code (one or more objects), which make use of document objects, one for each open document. For each action performed on a document, the application code requests a memento from the document object as a snapshot of the document's state at that point. When the user hits the 'undo' button, the application code just feeds the appropriate memento back to the document object in question, resetting it's state to whatever it was when the memento was taken. Pretty slick, really. If you've ever used undo, you know it doesn't stick around after you close the file, exit the program, or otherwise destroy the document object that created the info. In other words, mementos are runtime 'things', so you needn't serialize anything, though you'd probably want to clone any internal object instances. barneyb > -----Original Message----- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > Behalf Of Justin Balog > Sent: Wednesday, October 15, 2003 3:06 PM > To: '[EMAIL PROTECTED]' > Subject: [CFCDev] Memento > > > > Howdy, > > I have been looking back through the archives, and I am just starting to > wrestle with the concept of Memento. It takes me about a month to catch up > to the rest of the folks on the list =) > > I have looked at several sites describing the concept, but I am not > completely sure about it. I searched Sean's Blog, but strangely did not > find any results? I think the concept basically is intended to expose an > object's instance data without breaking any rules of encapsulation. > > My Example: > > If I had person.obj (apologize for the extension, just trying to make it > more generic) which was composed of address.obj, and some > instance vars such > as firstname and last name etc I would then have personMemeto.obj > that would > take in a person.obj, and return the instance vars in some 'flattened' > format to be use for persistence, etc.? > > If this is the case, I am running into the same issues I had with > serialization, how do you return instance vars composed of other > objects, or > multiple objects? > > Any thought would be appreciated. > > Thanks, > > Justin > ---------------------------------------------------------- > You are subscribed to cfcdev. To unsubscribe, send an email > to [EMAIL PROTECTED] with the word 'unsubscribe cfcdev' > in the message of the email. > > CFCDev is run by CFCZone (www.cfczone.org) and supported > by Mindtool, Corporation (www.mindtool.com). > > An archive of the CFCDev list is available at > www.mail-archive.com/[EMAIL PROTECTED] > ---------------------------------------------------------- You are subscribed to cfcdev. To unsubscribe, send an email to [EMAIL PROTECTED] with the word 'unsubscribe cfcdev' in the message of the email. CFCDev is run by CFCZone (www.cfczone.org) and supported by Mindtool, Corporation (www.mindtool.com). An archive of the CFCDev list is available at www.mail-archive.com/[EMAIL PROTECTED] ---------------------------------------------------------- You are subscribed to cfcdev. To unsubscribe, send an email to [EMAIL PROTECTED] with the word 'unsubscribe cfcdev' in the message of the email. CFCDev is run by CFCZone (www.cfczone.org) and supported by Mindtool, Corporation (www.mindtool.com). An archive of the CFCDev list is available at www.mail-archive.com/[EMAIL PROTECTED]
