Gents, Good discussion.
I'm not a guru either, but this definitely smells of strategy since it is likely a matter of a different validate() implementation being used under different contexts. So if you compose your User object with an AbstractValidation that is subclassed by, say, a UserLoginValidation, UserSaveValidation, etc. as concrete implementations, you'll delegate to variables.validator.validate(this). Your factory will have to be context aware in order to compose the User correctly. Strike that. It's not the Factory's job to know the context. Maybe, it should accept an argument to a createInstance() method like "LoginUser" or "User" (implying full validation) and return a correctly composed User object. This scenario sounds familiar. Hunt back in the CFCDEV archive, I believe Brian Kotek suggested a similar setup for Transfer Objects. His concept included a bridge pattern for Javascript validation as well. It looked quite robust. Anyway, I like the idea. Let us know how it goes! Paul > > Yes. I'm convinced. Strategy it is. I knew they were similar but after > > having a look at the UML for both patterns I can now see they are the > > same. It's the methods and internals of the cfc's themselves that > > differ: > > Don't be too convinced - I'm certainly no "patterns guru!" =) Perhaps the > others will chime in with their own opinions and offer something different. > I certainly can see a case made for State, but my own preference would be to > call it Strategy, that's all. > > Sam > -- Paul Marcotte Fancy Bread - in the heart or in the head? http://www.fancybread.com --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CFCDev" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cfcdev?hl=en -~----------~----~----~----~------~----~------~--~---
