D
djmc
Hi,
I am working to clean up an application that is split into 3 major layers
(asp.net, logic, data).
In the logic layer, many of the methods seem to have a fairly lengthy
validation process, which is eventually followed by the real purpose of the
method. For instance, if I have a method that passes in a series of
parameters, each parameter is checked, validated and in the case of errors,
the appropriate message is generated to be passed back to the presentation
layer. Finally, if all the validation has passed, I can call the data layer
modules to perform the updates to the various tables.
Does it seem extreme to split this logic layer into two separate layers
(validation and logic)? Is there a cleaner way to perform validation in the
logic layer?
The methods always look similar to this:
If()
Createerror("msg")
Else if()
Createerror("msg")
Else if()
Createerror("msg")
Else if()
...
Else
{
DoLogic1()
DoLogic2()
DoLogic3()
}
Sometimes the validation is really long. hheh, and it makes me sad.
Oh well.. If this is a small issue and nobody really worries about this,
then please let me know too!
I am working to clean up an application that is split into 3 major layers
(asp.net, logic, data).
In the logic layer, many of the methods seem to have a fairly lengthy
validation process, which is eventually followed by the real purpose of the
method. For instance, if I have a method that passes in a series of
parameters, each parameter is checked, validated and in the case of errors,
the appropriate message is generated to be passed back to the presentation
layer. Finally, if all the validation has passed, I can call the data layer
modules to perform the updates to the various tables.
Does it seem extreme to split this logic layer into two separate layers
(validation and logic)? Is there a cleaner way to perform validation in the
logic layer?
The methods always look similar to this:
If()
Createerror("msg")
Else if()
Createerror("msg")
Else if()
Createerror("msg")
Else if()
...
Else
{
DoLogic1()
DoLogic2()
DoLogic3()
}
Sometimes the validation is really long. hheh, and it makes me sad.
Oh well.. If this is a small issue and nobody really worries about this,
then please let me know too!