On 10/23/2007 10:08 AM, John Siracusa wrote:
> Again, in every large web app I've created, each database table has > several forms that write into it--sometimes only writing partial > values. The HTML form layer is usually the most restrictive, the ORM > less so, and the db itself is the most permissive. At each level, > business rules and permissions dictate the ever-increasing specificity > of the validation. > > That's not to say that it's a bad idea to initially *derive* > validation from the db metadata. That's a great starting point. But > I'm wary of any attempt to *combine* it all into a single place, > making it harder to diverge the validation at each level, because IME > that always needs to be done eventually. > Yes, I see your point. It jives with my experience as well. I am taking the "derive form validation from db metadata as a starting point" approach. When I wrote about trying to tie the 2 together more closely, I was thinking of the case where data is coming into the ORM and bypassing the Form layer, as through a test or a mass import or similar. Then I would like my ORM validation layer to apply checks that are consistent with the Form layer checks. I'm just not sure how best to do that. There are 4 options I imagine: (1) keep 2 sets of code in sync (one in Form, one in ORM) (2) the ORM calls the Form validation code (3) the Form calls the ORM validation code (4) the Form and ORM both call some external validation code #1 is how things work currently. Not ideal since there is more room for error with code getting out of sync. #2 means that the Form code must always be loaded. Not ideal for the situations I describe above (tests, etc), but not unworkable either. RHTMLO has more discrete data types and built-in validation, so this has the advantage of not reinventing a wheel. #3 means that RDBO validation code would need some work. #4 is the most flexible, but I would want to leverage the existing validation code in RHTMLO. So while I'm not a DRY zealot, I would like to have consistency without duplicating code. -- Peter Karman . [EMAIL PROTECTED] . http://peknet.com/ ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ _______________________________________________ Rose-db-object mailing list Rose-db-object@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rose-db-object