Best practices for validating business rules

H

hardieca

Hi,

I'd like to know if anyone knows of any resources detailing the best
practices of validating rules in the business tier and providing
helpful error messages to users in the UI tier. All the information I
have come across seems to revolve around using validation controls on
the webpages themselves, which is not always feasible.

Regards,

Chris
 
C

Cowboy \(Gregory A. Beamer\)

There are a couple of things you can do. IN general, however, I find it
easiest to throw exceptions up to the UI for problems and then parse the
exception there. It is very specific and does not require passing back
values.

Of course, you can also use enums.

public MyEnum TestValidation()
{

if(failedOneValidation())
return MyEnum.FailedOneValidation;
if(failedTwoValidation())
return MyEnum.FailedTwoValidation;

}

But, this is harder if you embed it down levels, which often happens in
tiered approaches. Exceptions can bubble all the way to the UI and be
handled there.

To make sure these validations are logged, you can use the new policy
injection block (part of EntLib 3.1). Then you can turn on or off items by
config.
 
B

bruce barker

a common approach popular in the java world is to use a rules engine
thats hosted by the business logic layer (JBoss, JxBRE, SRE, etc). this
layer can also pass info used to generate the page validators, so
validation logic is all in one place.

on sourceforge.net, along with the java source you can find some .net
ports. there are also commercial products.

-- bruce (sqlwork.com)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,564
Members
45,040
Latest member
papereejit

Latest Threads

Top