Kevin Jones wrote:
>
> Of course you need to validate on the server as well, but, if the client
> validates first the server validation is *much* cheaper, since the cost is
> *not* in the validation it's in the round trip.
> ... but the cost of checking is in the noise compared to the cost of a
> roundtrip if the validation fails on the server,
>

 The "always validate as close to the user as possible"
rule of thumb is seductive, but applying it can be costly.

 The rule's applicability depends on the application, the
deployment environment, and the resource constraints the
dev team is facing:

 - Do 1% or 50% of users submit data with errors?

 - Are most of the errors easy-to-detect formatting
   errors or hard-to-detect logical errors?

 - Is the application being deployed on a corporate lan
   or is it directed towards dial-up users on the
   internet?

 - Are server resources a bottleneck?

 - Is it a tiny little app with 10 pages, or a big
   honking enterprise app with 1000 (or more) pages?


 And there's also the (potentially heavy) costs to
consider:

 - Somebody (generally[1]) has to write the validation
   code, and that costs money and time.

 - Somebody has to maintain the validation code, and
   that costs money and time.

 - Somebody has to test the validation code (on a bunch
   of browsers) and that costs money and lots and lots
   of time.

 - Even using a library of validation code has
   associated costs (like training, maintenance, and
   even the extra bandwidth on every page to download
   it :-)

 - And, most importantly: do you really have the time
   to spend getting the client-side code right when
   the server-side code isn't finished yet...

 Although client-side-validation is a very good optimization
in many cases, there's no sense writing and maintaining
code for an optimization that doesn't address a bottleneck.

 Thus endeth the rant :-)


[1] Some application frameworks will generate both the
server and client side code directly from business
rules, so my arguments don't apply.


--
Christopher St. John [EMAIL PROTECTED]
DistribuTopia http://www.distributopia.com

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to