I am working on validation for my User cfc. On different parts of the
site when users register different criteria are asked for.

ie we offer a quick registration process where only email, username
and password are mandatory. There is also a full registration where
additional fields are mandatory. There will also be a third situation
where different fields are mandatory if they are on the American
version of the site, also slight changes for the German site.

I thought that rather than have all the conditional code inside the
bean that will constantly need tweaked I would use either State or
Strategy pattern.

State makes more sense to me and would create an abstract class (cf7
at the mo so no interfaces) called UserValidationState which would be
subclassed by QuickRegValidation.cfc, FullRegisterValidation.cfc,
QuickRegValidationUS.cfc etc etc and compose these concrete CFC's
using the State pattern.

I have a little bean factory that will create and compose the cfc's
when a User object is created. Either client code or a service cfc
will determine the state the object will be in when it is created.

I'm interested in how others would approach it.

Is using State the best way to do this or does Strategy make more
sense (or something else I haven't thought of)?

Lots of if statements in User.cfc is the one thing I don't want!

Thanks

Alan
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to