Re: Where Do You Put Your Error Checking Code?

2008-07-07 Thread Tom Chiverton
On Friday 27 Jun 2008, Ian Rutherford wrote:
 So for the most part you would keep your business logic out of the database
 and take care of that in CFCS / cfm / ajax logic before hand?

Yup, with the note that business rules should never be solely in the client, 
because the client can't be trusted.

-- 
Tom Chiverton



This email is sent for and on behalf of Halliwells LLP.

Halliwells LLP is a limited liability partnership registered in England and 
Wales under registered number OC307980 whose registered office address is at 
Halliwells LLP, 3 Hardman Square, Spinningfields, Manchester, M3 3EB.  A list 
of members is available for inspection at the registered office. Any reference 
to a partner in relation to Halliwells LLP means a member of Halliwells LLP.  
Regulated by The Solicitors Regulation Authority.

CONFIDENTIALITY

This email is intended only for the use of the addressee named above and may be 
confidential or legally privileged.  If you are not the addressee you must not 
read it and must not use any information contained in nor copy it nor inform 
any person other than Halliwells LLP or the addressee of its existence or 
contents.  If you have received this email in error please delete it and notify 
Halliwells LLP IT Department on 0870 365 2500.

For more information about Halliwells LLP visit www.halliwells.com.

~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;203748912;27390454;j

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:308667
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Where Do You Put Your Error Checking Code?

2008-06-27 Thread Ian Rutherford
When you are writing your code, where do you handle error checking?

Do you handle it with Javascript on the front end? With code before you hand 
the data to a CFC, in CFCs, in your T-SQL code? Or do you duplicate the error 
checking at each step along the way? 

~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;203748912;27390454;j

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:308254
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: Where Do You Put Your Error Checking Code?

2008-06-27 Thread Jerry Johnson
All of the above.

The more user-friendly code and descriptions happen on the same page via js
checks.
The sql code typically throws a generic error.

And the stuff in between is somewhere in the middle.

On Fri, Jun 27, 2008 at 3:20 PM, Ian Rutherford 
[EMAIL PROTECTED] wrote:

 When you are writing your code, where do you handle error checking?

 Do you handle it with Javascript on the front end? With code before you
 hand the data to a CFC, in CFCs, in your T-SQL code? Or do you duplicate the
 error checking at each step along the way?

 

~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;203748912;27390454;j

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:308255
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


Re: Where Do You Put Your Error Checking Code?

2008-06-27 Thread Dominic Watson
I personally never use js for validation; I always do it server side. I make
sure the database has its own validation checking (using constraints, etc)
and I also check the submitted data with ColdFusion before sending it to the
database.

Dominic

2008/6/27 Jerry Johnson [EMAIL PROTECTED]:

 All of the above.

 The more user-friendly code and descriptions happen on the same page via js
 checks.
 The sql code typically throws a generic error.

 And the stuff in between is somewhere in the middle.

 On Fri, Jun 27, 2008 at 3:20 PM, Ian Rutherford 
 [EMAIL PROTECTED] wrote:

  When you are writing your code, where do you handle error checking?
 
  Do you handle it with Javascript on the front end? With code before you
  hand the data to a CFC, in CFCs, in your T-SQL code? Or do you duplicate
 the
  error checking at each step along the way?
 
 

 

~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;203748912;27390454;j

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:308256
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


Re: Where Do You Put Your Error Checking Code?

2008-06-27 Thread Barney Boisvert
Full validation is mandatory on the server-side.  Client-side
validation can smooth the user experience, but that's all it does.

Your web layer should ensure everything is syntactically valid and do
any necessary conversions.  For example, if I submit a birth date via
a form, the actual form parameter is a string, so it needs to be
converted.  That hands off to your business layer where semantic
validation should happen (birth date is before death date, both are in
the past, etc.).  By the time you get to the data layer, almost no
validation should be happening.  The notable exception is stuff like
uniqueness constraints and the like.

Using JS for validation, especially combined with AJAX to do
server-side processing, can yield a HUGE improvement in the appearance
of your application.  Things like checking if a username is unique
before submitting the form, and telling the user right there if they
need to pick a new one.  Note that this uniqueness check does NOT
count as validation, because the form is optional, only the POST is
required.

cheers,
barneyb

On Fri, Jun 27, 2008 at 12:20 PM, Ian Rutherford
[EMAIL PROTECTED] wrote:
 When you are writing your code, where do you handle error checking?

 Do you handle it with Javascript on the front end? With code before you hand 
 the data to a CFC, in CFCs, in your T-SQL code? Or do you duplicate the error 
 checking at each step along the way?

 

~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;203748912;27390454;j

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:308257
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


Re: Where Do You Put Your Error Checking Code?

2008-06-27 Thread Sonny Savage
I recently wrote some form validation.  I the validation was done in CF but
was done through an AJAX call when JS was available.  I feel this is the
best of both worlds.  The end-user gets nice JS interaction when available
and the validation is written only ONE time on the server-side where it
can't be circumvented.

Edward A Savage Jr - Sonny
Senior Software Engineer
Creditdiscovery, LLC
An appeaser is one who feeds a crocodile, hoping it will eat him last. ~
Sir Winston Churchill

On Fri, Jun 27, 2008 at 4:09 PM, Dominic Watson 
[EMAIL PROTECTED] wrote:

 I personally never use js for validation; I always do it server side. I
 make
 sure the database has its own validation checking (using constraints, etc)
 and I also check the submitted data with ColdFusion before sending it to
 the
 database.

 Dominic

 2008/6/27 Jerry Johnson [EMAIL PROTECTED]:

  All of the above.
 
  The more user-friendly code and descriptions happen on the same page via
 js
  checks.
  The sql code typically throws a generic error.
 
  And the stuff in between is somewhere in the middle.
 
  On Fri, Jun 27, 2008 at 3:20 PM, Ian Rutherford 
  [EMAIL PROTECTED] wrote:
 
   When you are writing your code, where do you handle error checking?
  
   Do you handle it with Javascript on the front end? With code before you
   hand the data to a CFC, in CFCs, in your T-SQL code? Or do you
 duplicate
  the
   error checking at each step along the way?
  
  
 
 

 

~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;203748912;27390454;j

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:308258
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


RE: Where Do You Put Your Error Checking Code?

2008-06-27 Thread Brad Wood
Only if you call that server-side validation a second time after the
form is submitted to the server.

~Brad

-Original Message-
From: Sonny Savage [mailto:[EMAIL PROTECTED] 

I recently wrote some form validation.  I the validation was done in CF
but
was done through an AJAX call when JS was available.  I feel this is the
best of both worlds.  The end-user gets nice JS interaction when
available
and the validation is written only ONE time on the server-side where it
can't be circumvented.


~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;203748912;27390454;j

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:308259
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


Re: Where Do You Put Your Error Checking Code?

2008-06-27 Thread Sonny Savage
If the data is valid it is saved and the client is redirected.  Without JS
the form is submitted normally and goes through the same validation.

Edward A Savage Jr - Sonny
Senior Software Engineer
Creditdiscovery, LLC
An appeaser is one who feeds a crocodile, hoping it will eat him last. ~
Sir Winston Churchill

On Fri, Jun 27, 2008 at 4:41 PM, Brad Wood [EMAIL PROTECTED]
wrote:

 Only if you call that server-side validation a second time after the
 form is submitted to the server.

 ~Brad

 -Original Message-
 From: Sonny Savage [mailto:[EMAIL PROTECTED]

 I recently wrote some form validation.  I the validation was done in CF
 but
 was done through an AJAX call when JS was available.  I feel this is the
 best of both worlds.  The end-user gets nice JS interaction when
 available
 and the validation is written only ONE time on the server-side where it
 can't be circumvented.


 

~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;203748912;27390454;j

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:308260
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


RE: Where Do You Put Your Error Checking Code?

2008-06-27 Thread Brad Wood
Ahh, I see.  You are doing validation and processing with a single Ajax
call on the server if JS is supported.  That would work well.

~Brad

-Original Message-
From: Sonny Savage [mailto:[EMAIL PROTECTED] 
Sent: Friday, June 27, 2008 3:55 PM
To: CF-Talk
Subject: Re: Where Do You Put Your Error Checking Code?

If the data is valid it is saved and the client is redirected.  Without
JS
the form is submitted normally and goes through the same validation.

Edward A Savage Jr - Sonny
Senior Software Engineer
Creditdiscovery, LLC
An appeaser is one who feeds a crocodile, hoping it will eat him last.
~
Sir Winston Churchill

On Fri, Jun 27, 2008 at 4:41 PM, Brad Wood [EMAIL PROTECTED]
wrote:

 Only if you call that server-side validation a second time after the
 form is submitted to the server.

 ~Brad

~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;203748912;27390454;j

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:308262
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


Re: Where Do You Put Your Error Checking Code?

2008-06-27 Thread Ian Rutherford
So for the most part you would keep your business logic out of the database and 
take care of that in CFCS / cfm / ajax logic before hand? 

~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;203748912;27390454;j

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:308265
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


RE: Where Do You Put Your Error Checking Code?

2008-06-27 Thread Brad Wood
I am for keeping unnecessary business logic out of the database, but I
am still a proponent of enforcing data types and foreign key constraints
at the database level.

~Brad

-Original Message-
From: Ian Rutherford [mailto:[EMAIL PROTECTED] 
Sent: Friday, June 27, 2008 4:38 PM
To: CF-Talk
Subject: Re: Where Do You Put Your Error Checking Code?

So for the most part you would keep your business logic out of the
database and take care of that in CFCS / cfm / ajax logic before hand? 

~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;203748912;27390454;j

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:308266
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


RE: Where Do You Put Your Error Checking Code?

2008-06-27 Thread Dave Watts
 When you are writing your code, where do you handle error checking?
 
 Do you handle it with Javascript on the front end? With code 
 before you hand the data to a CFC, in CFCs, in your T-SQL 
 code? Or do you duplicate the error checking at each step 
 along the way?

Well, there's validation and then there's validation.

Generally, I like to put simple validation tests (is this a number? is it a
zip code? etc) both in my web application server layer and/or database and
in my client logic as well. So, there's a certain amount of duplication
there.

Business logic, of course, must reside on the web application server at
least, but invoking it via AJAX or Remoting lets you use the same logic in
the client without duplication. I generally don't put business logic in the
database, but I wouldn't go so far as to say you shouldn't do that. I've
seen some very nice applications where the database does all of this stuff,
and all you do from your web app is just call the appropriate stored
procedure - no SQL is placed in the web app at all.

Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/

Fig Leaf Software provides the highest caliber vendor-authorized
instruction at our training centers in Washington DC, Atlanta,
Chicago, Baltimore, Northern Virginia, or on-site at your location.
Visit http://training.figleaf.com/ for more information!

~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;203748912;27390454;j

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:308267
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


Re: Where Do You Put Your Error Checking Code?

2008-06-27 Thread denstar
If you jump up a level, and then use code-generation, you can take
care of a lot of various needs from one model.

-- 
One model to rule them all, and in the darkness bind them.


On Fri, Jun 27, 2008 at 3:38 PM, Ian Rutherford  wrote:
 So for the most part you would keep your business logic out of the database 
 and take care of that in CFCS / cfm / ajax logic before hand?

~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;203748912;27390454;j

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:308273
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4