Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Where to place the bizrules?
Message
General information
Forum:
Visual FoxPro
Category:
Object Oriented Programming
Miscellaneous
Thread ID:
00612687
Message ID:
00613514
Views:
15
Hi John,

Like Travis said, it depends...

If you are going to be checking those rules from other bizobjs, you might be better off creating a bizrules object.

In the MereMortals framework the rules reside in a separate object, but I still can put rules in my bizobj if I want to and call them before I call the save method.

Placing bizrules in separate objects will make it easier to maintain your apps because you will always know where the rules reside and if you needed to change, remove, or add rules, you always know where to go.

In addition, you may want to call a specific rule directly from a form to make sure, for example that a date is valid BEFORE you even think of saving any data. This approach will allow you to validate on entry (which is more useful to your users) and also when you're ready to call the save() method (which is useful for you as a developer).


Hope this helps!

Alex

>Hi,
>Thank you for you reply.
>I would like to ask again, does the following "actions" consider as business rules? Should I place it in my business object.validate()?
>
>Example:
>1. Make sure the selected staff record is existed while saving a sales order.
>
>2. Check the data type passed to my data member.
>
>3. Any actions that needed to ensure referential integrity.
>
>In my business base class, it contains New(), Load(), Save() and etc method. It seem work directly to vfp native data. Is it considered as data layer? If yes, Could you please show me some sample that seperate business rules with data layer?
>
>Thank you
Low-carb diet not working? Try the Low-food diet instead!
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform