Thanks to all who have suggestions on the how to structure cfcs for validation/authentication.
Various responses below: To Jamie: Thanks for the input. When I start handling larger forms, I'll determine whether this is a robust (enough) solution. To Mr. Bell: "User.authenticate()" looks very ActiveRecord to me (which I am not using). I'll hazzard a guess that User (as a transient) has UserDAO "LightWired" into it. ;-) To Aaron: Clever idea, using a validator object. I wonder what it would take to write a method interceptor using Colspings aop to wrap that? Validation as a cross-cutting concern? (Yes, I'm woolgathering...) To Mr. Farrell: This is what I'm concerned about. Having to overhaul my design because of increased complexity. To Nando: I'm sure I'll roll it a couple of different ways until it feels right. Thanks, again! Paul -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Peter J. Farrell Sent: Wednesday, February 28, 2007 2:48 PM To: [email protected] Subject: Re: [CFCDEV] Where should I validate form submissions? Nando said the following on 2/28/2007 4:32 PM: > Why shouldn't a user know how to validate it's own data? To me it depends on how much you need to validate your bean. We have some pretty complex validation routines in one our applications. We needed access to UDFs, which felt dirty to inject in the bean (I know that Peter Bell would disagree), manage UDFs inside the bean or use cfinclude (could cause namespace issues). We also sometimes have to do more complex things -- like checking if the password meets our requirements -- all the normal stuff plus things like not allowing stupid words like first/last name, email address or current user name. All of this requires access to things external to the bean -- this of course is overly simplified for illustration purposes in this email. So after a while, letting the bean know how to validate itself became unreasonable for us. In the end, we don't mind that our beans are very stupid and a bit anemic. Those are my two cents and I'm sure in the future I'll have more to say. > Maybe you could try both approaches and see which you like better? Most definitely. Trying is the only way you learn otherwise we can debate this forever! ;-) .Peter -- Peter J. Farrell - Maestro Publishing http://blog.maestropublishing.com -- Co-Host of the ColdFusion Weekly Podcast http://www.coldfusionweekly.com You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/[email protected] You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/[email protected]
