Framework / Design pattern for business rule validation

16,885

Solution 1

  • framework is specifically designed to evaluate business rules

  • framework allows writing beans using dynamic languages like and . You can easily plug JavaScript

  • strategy design pattern seems like a good fit: implement each rule as a separate strategy and run them one after another.

  • similar chain of responsibility pattern can be used: each rule either fails or succeeds and passes control to next rule

Solution 2

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.

Share:
16,885
ilovetolearn
Author by

ilovetolearn

Updated on June 05, 2022

Comments

  • ilovetolearn
    ilovetolearn almost 2 years

    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?