On Thu, June 8, 2006 1:09 pm, Michael Jouravlev wrote:
> On the other hand, the whole idea of Struts/Commons Validator sucks
> big time, because database already has all necessary validations,
> domains, triggers, etc. Since most apps use database anyway, input
> data should either be validated directly by a database or by DAO; DAO
> should pull metadata from database to build validation/conversion
> rules. Seems that Ruby on Rails is closer to this approach, while most
> other frameworks do the same job twice or even three times.

I *totally* disagree with this :)

If a user is supposed to enter a first name, and they don't, there is NO
WAY I want to be going through all the overhead of hitting my database to
find that out.  That's just a recipe for disaster in terms of scalability.
 Even if you ask the DAO to do it, and even if all the rules are in the
DAO and the databse doesn't have to get involved, it's still going down
too far into the application.  I grant you that some level of validation
still generally should happen there, as well as at the database, but in
general you want to catch any sort of validation error as soon as you can,
whether that means Javascript on the client for simple things or in the
database for more complex things (i.e., referential integrity).

No, you want as much validation to occur as close to the source of the
problem as possible.  I agree with you that doing it 2 or 3 times isn't
good, and there is probably room for improvement in this regard, but I
definitely would not let it fall to the database as a rule.

Also, to assume that everyone has all sorts of triggers and domains and
such on their databases is, in my experience, a fallacy.  I've seen
numerous databases that have nothing more than required fields and
referential intergrity defined, and that's it.  Any data coming in is
assumed to otherwise have already been validated.  Some people are
downright averse to doing more in the database for various reasons.

> Michael.

Frank

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to