Back to list
Views:   9.3K
Replies:  1
Archived

Complex Business Rule - Validation sample

Hi,

I recently purchased Design Pattern Framework 4.0.

In the document it is mentioned like
Here is an example of a more complex rule. There may be a rule that states that customers are ranked according to their recent order history. Customers with 10 or more orders over the last 3 months receive gold status, customers with 5 to 10 orders receive silver status, and customers with fewer than 5 orders are given bronze status. These statuses can be used to determine the relative priority treatment they receive when calling a 1-800 customer support number. When an order is placed, the rule in the business object re-evaluates the customer‟s ranking. These kind of rules require (in most cases) custom validation code.

Another is
In a more complex application you may have interdependent business rules encoded outside these objects (for example, if the bank account is over $5000 and more than 3 transactions have taken place in the last month, and the account holder‟s age is > 35 and is on the same job for more than 2 years, then accept the application).

Can someone guide me where and how to write above two validation in existing Design Pattern Framework 4.0.

Regards,

Zeinab Aliakbari, Jun 20, 2012
Reply 1
These rules are encoded in the Service Layer.

In the first example, when saving the order, you 1) save the order, and then 2) evaluate all the rules and update the user's record. These actions should be bracketed by a Transaction, which is also done in the Service Layer.

Second example also takes place in the Service Layer. When requesting approval for a mortgage you have a method on the Service Layer that evaluates all the conditions and renders a final answer back to the user.

Hope this helps.
Tim Sawyer, Jul 12, 2012


Stay Inspired!
Join other developers and designers who have already signed up for our mailing list.
Terms     Privacy     Licensing       EULA       Sitemap      
© Data & Object Factory, LLC.
Made with    in Austin, Texas