473,386 Members | 1,715 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

proper n-tier validation

I was wondering other opinions on this topic... I am working on an n-tier
application which may be broken out to different servers at a later date.
How should I go about the validation? I would like to assume that the UI
later will handle a lot of this but I cannot be 100% set on this as another
developer may not expose all the validation rules if they make a new front
end. Right now my data access layer uses checks within the procedures as
well as constraints and foriegn keys. This however again doesn't make my
data 100% but helps a great deal. I was thinking about having a custom
exception in my BLL named ValidationException in which I can do all checks
there. This way when users screw up on entry I can catch this in the UI to
display a friendly error message instead of passing it to my exception
handler. I would still do client side validation as well to cut down on the
exceptions thrown. What are your thoughts on this method and is this quite
common in n-tier applications where there may be multiple developers working
on different UIs?
Jun 23 '06 #1
1 1369
You certainly want to catch any simple errors you can easily catch on the UI
layer. For example a person puts "some words" in a date field. You can also
check basic email address, etc.

But, you also want to set up your system so it does not trust user input, so
your other layers should have checks as well. Any time you make a jump you
should consider some form of validation. If the system is distributed, but
closed (you have closed down access to the UI app you have only - not very
flexible, of course), you can be a bit more lax, but the saved cycles will
do less for scalability than other refinements. I would also not be fond of
this approach as you lock a variety of applications/services into a single
solution.

You should also make sure your database helps avoid obviously bad data.
Using proper data types, relations and constraints will cover most of your
needs here. Use triggers if there is something that is hypercritical that
requires logic.

--
Gregory A. Beamer

*************************************************
Think Outside the Box!
*************************************************
"Nick" <nt********@online.nospam> wrote in message
news:71**********************************@microsof t.com...
I was wondering other opinions on this topic... I am working on an n-tier
application which may be broken out to different servers at a later date.
How should I go about the validation? I would like to assume that the UI
later will handle a lot of this but I cannot be 100% set on this as
another
developer may not expose all the validation rules if they make a new front
end. Right now my data access layer uses checks within the procedures as
well as constraints and foriegn keys. This however again doesn't make my
data 100% but helps a great deal. I was thinking about having a custom
exception in my BLL named ValidationException in which I can do all checks
there. This way when users screw up on entry I can catch this in the UI
to
display a friendly error message instead of passing it to my exception
handler. I would still do client side validation as well to cut down on
the
exceptions thrown. What are your thoughts on this method and is this
quite
common in n-tier applications where there may be multiple developers
working
on different UIs?

Jun 24 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Bruce W...1 | last post by:
For include files I see both the file extensions .php and .inc used. Which one is proper? Does it matter? What's the diff? Thanks for your help.
0
by: T. Kaufmann | last post by:
Hi there, I have some lines of code in a Tkinter programm - I want to list every single file of a zip-archive in a Text widget: fp = os.popen("%s %s" % ('unzip -vl ', 'anyarchiv.zip', 'r')...
3
by: m.ramana | last post by:
Given a string it should convert it to a proper text. Example: if you passed a string 'Cat in the hat', I want 'Cat In The Hat' Curious about few things, Does sql have Instr OR Split(like VB)...
2
by: JTrigger | last post by:
I am rather new to the XML and XSD world and was wondering what the code would look like to write the following XSD items as classes in C# with all the proper XML attributes to make them...
2
by: Kevin | last post by:
I am currently importing data into Access 2002 from 3 Sybase ASA 7.0 databases over a network. At this time I am using a ODBC System DSN connection using the proper ASA 7 driver. I would like to...
1
by: RC | last post by:
I have an Access 2002 database with many tables and forms (but just to keep things simple, let's say the DB has one Table "Table1" and one Form "Form1"). I have managed to cobble together so much...
0
by: bj | last post by:
hello is there any chance to get proper char width for class derived from user control - im working over text editing control, so i need proper width of every character for currently selected...
0
by: yogarajan | last post by:
hi all i need proper alignment my treeview looks like <checkbox>Fruits(parent)-134 <checkbox>Mango(child)-45 <checkbox>Orange(child)-45 ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.