Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Where to place the bizrules?
Message
De
31/01/2002 12:41:00
 
 
À
31/01/2002 10:17:34
Information générale
Forum:
Visual FoxPro
Catégorie:
Programmation Orientée Object
Divers
Thread ID:
00612687
Message ID:
00613513
Vues:
20
>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.

Referential Integrity. Should be enforced by the data services.

>
>2. Check the data type passed to my data member.

Data validation belongs in business services.

>
>3. Any actions that needed to ensure referential integrity.

Data.

>
>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?

You're going to have methods to do that in all three layers. The differences are where the code that does the actual work is at. The lines get blurred in some cases. For example, there are only 50 states. This makes it easy to validate. However, you could provided this list in a drop down on the form, so the user can only pick a valid option. Also, where do you check that a required field is entered? Is it UI, Biz, or data? IMO, the answer is: it depends. If it's a web form, I would check this with some javascript on the form before submitting it to the server. On a Windows form, I would have to decide based on the application.

>If yes, Could you please show me some sample that seperate business rules with data layer?

Validating data belongs in the biz rules. Examples:

- A customer places an order. You need to make sure they aren't over their credit limit.
- You enter a new customer and need to validate the zip code.
- Calculating shipping charges.
- You need to total an invoice. This would include adding all the line items, applying tax, shipping charges, etc.

A good book that may help you sort all this out is "Designing for Scalability with Microsoft WIndows DNA", MS PRess, ISBN 0-7356-0968-3. It could use a more thorough example, but its good to help you learn the concepts. ALl the code is VB, but you could do in VFP without any problems.

Also, you could watch for comcodebook.com to come back online and study the design of that framework.


>
>Thank you
Craig Berntson
MCSD, Microsoft .Net MVP, Grape City Community Influencer
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform