Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Framework / Design pattern for business rule validation [closed]

What kind of framework / design pattern should I use for application which possibly has 1000 over biz rule validations?

The type of systems I am working on consist of lots of input forms which allow users to enter. Each input form has different sections.

i.e. Form A has Section A/B/C/D. Form B has section B/C/D

Some of these biz rule validation are common to both forms, I am looking at a approach to reuse the rules as well.

How do I build a robust business rule validation framework?

like image 750
ilovetolearn Avatar asked Jun 03 '12 12:06

ilovetolearn


People also ask

Which pattern will you use to to make business rules readable?

Rules design pattern helps the developer to encapsulate each business rule in a separate object and decouple the definition of business rules from their processing. New rules can be added without the need to modify the rest of the application logic. Let's see how this can help us improve our file validation logic.

How do you create a validation rule?

If you add a validation rule to an existing table, you might want to test the rule to see whether any existing data is not valid. Open the table that you want to test in Design View. On the Design tab, in the Tools group, click Test Validation Rules. Click Yes to close the alert message and start the test.

What are the rules for DDD?

In DDD, validation rules can be thought as invariants. The main responsibility of an aggregate is to enforce invariants across state changes for all the entities within that aggregate. Domain entities should always be valid entities. There are a certain number of invariants for an object that should always be true.


1 Answers

A good pattern to implement business rules is the Specification pattern. It's a combination of Strategy, Composite and Interpreter that can make for parameterized and easily combinable rules. Be sure to also look at the original paper (pdf) by Fowler and Evans, and take a look at the book Domain Driven Design if you can.

like image 97
Jordão Avatar answered Oct 13 '22 16:10

Jordão