Performance considerations

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi all

I am currently designing a program that uses the ado.net.

I have a question..

Which is better? To have your data constraints implemented on the dataset or constraints on the database? Or both

Thanks a million
 
Depends on how important data integrity is to you. There's no excuse for
not having constraints on the backend b/c your app is not the only way that
data can get entered and your asking for disaster if you don't have the DB
enforce it's own integrity. (I know there are a lot of people that will say
that this isn't the case, that they will never have users access the DB with
anything but their app etc...but even if that's the case, you'll have to
write a Whole lot of extra code and if by any chance anyone ever gets
visual tools for the db or another program is written, you'll probably
encounter some serious drama).

On the other hand, client side validation is important too, if for no other
reason than User experience. If you go with only backend Validation, users
may enter junk into your app, only to have the DB reject it---they'll get
some lovely MessageBox barking at them and they'll get annoyed quickly. So,
features like disabling things that users shouldn't do or preventing them
from continuing if invalid data is entered is pretty important..not so much
for performance as user experience, but performance wise it's a waste to
send data that you know won't conform to the DB only to have it tell you
it's junk.

Hence, a combination of validation with all of the necessary constraints on
the backend will allow your app to scale and you won't have to worry about
coding around every possible secnario of user errors. On the ADO.NEt side,
providing adequate constraints there can enforce your validation logic
before it ever has to go back to the db. This uses some additional
resources locally, but it saves network and database resources. ADO.NET
constraints wedded with UI (like disabling the Ok button until all the
required fields are entered and putting an asterisk or some other identifier
next to all labels on required fields) validation (you have a ton of UI
events for any given control particularly validating to accomplish this.

In short, I think validation at all levels is necessary if you want an app
that is bullet proof and won't break when any modifications are done.

HTH,

Bill
A said:
Hi all!

I am currently designing a program that uses the ado.net.

I have a question...

Which is better? To have your data constraints implemented on the dataset
or constraints on the database? Or both?
 
Back
Top