Hi,
IN the business layer method should we always wright code to validate the input parameter types?
TY in Advance
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Niradhip ChakrabortyPosted Sep 16, 2009, 1:47 AM
Ya, it is important to validate the input parameters. You will never no what online user enters in the input field until you validate it properly and force them enter some meaningful data.
For example if you don't have numeric validation for phone no or zip code may be they will enter some characters which is not accepted. Same way if you don't have validation for credit card no may be they will enter less than 16 digits in input field which throw error in payment getaway.
So it is always a good idea to have either server side or client side validation for input fields.
I generally prefer server side validation. Because if hacker disable the browser scripting then client side validation will not work but server side validation will always work.
Please check the "Do you like the answer" checkbox, if the answer helps you.
Roei BarPosted Sep 16, 2009, 3:34 AM
you say that i am incorrect and NirdaShip said the exact same thing and you accepted his answer??
my point is that BL is only Business Logic and it does not need to support Incorrect Values inserted to it.
the UI is the one to do that job, if you are developing only BL and it is deployed to other users to use and you want validation its OK, but still its not the location todo that
petre ricardoPosted Sep 16, 2009, 2:08 AM
Roei BarPosted Sep 16, 2009, 1:50 AM
in general Validation should be in the UI Layer, so that there will be no access to the Business Layer with Garbage Information, it saves Time since the Client will stop most things, still its always good to validate on server side.
the Business Layer should always consist on getting the types it needs and nothing else from the client, since it is not its job to validate input.
its job is to run the Business Process.