On 10/2/07, Ronan Lucio <[EMAIL PROTECTED]> wrote:
>
>
> Hi,
>
> Where do you use to put Business Logic?
>
> Let's see if I understand it right:
> I use to add some validation inside insert() methods,
> for example: It only can add an user it the fields
> name and department were supplied.
>
> The validation to check if the fields name and department
> were correctly supplied is the Business Logic, right?
>
> Once it can't add an user without these fields I use
> to check the fields inside daoUser.insert()
>
> So I have Business Logic inside DAOs.
> Is it a good practice?
> If not, how can it be sure any user would be added
> without the required fields?



You could do that.  I like the thought of having a validator object, which
gets composed by the object that needs validation (object X, we'll call
it).   Then object X tells the validator what its rules are, and validator
checks that all the rules match.  This allows easy reuse of rules that are
quite common.

So X knows what is supposed to be valid, and validator tells it if it is or
not.

That's not the best explanation, but hopefully one of you guys who also
likes the idea can clean up after the mess I've made.  =)

Sam

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CFCDev" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cfcdev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to