0

I'm looking into NRules.Net to implement my pricing engine. After some testings, I don't really understand the benefits of using a .net rules engine vs using a rich domain model...

  • Rules are still plain CS classes (there is nothing dynamic)
  • I have to deal with a black-box (the rule engine) which does not allow me to understand what is going on

In the end, why shall I go for a .net rule engine? Is there anything I'm missing?

Thanks Seb

  • Is it easy to comprehend? What's your bus factor? Will your users want to [customize the rules](https://stackoverflow.com/questions/46756032/ui-for-creating-business-rules-in-nrules) or have documentation on them? Is it easy to debug? – lloyd Nov 02 '17 at 05:48
  • Only developers will customize the rules based on inputs given by our marketing teams. At this stage it's easy to comprehend/debug. –  Nov 02 '17 at 07:24
  • 1
    I'd avoid an external engine unless it brings real benefit like chaining rules together with complex boolean logic (&&, OR, XOR, etc.) If rules are just plain classes what is the point of using such a black box for calculating them? I have implemented a simple rules engine in our project (PHP) where every rule is a class and contains its logic. The only point in using complex rule engines (for me) is when you are using a very very parametrized workflow solution (i.e. a dynamic workflow builder) – Borislav Sabev Nov 03 '17 at 07:12

1 Answers1

0

A rules engine allows you to reason about a Rule as a concept of its own and gives you an elaborate language to play with rules.

You can compose rules dynamically, classify and manipulate lists of rules with different priorities, manage conflicting rules, express them with a convenient DSL that business people might understand, create transformations to make an object comply with a rule, etc.

Without an abstraction of what a Rule is, you can't do all this in a conscious, consistent way.

Not all domains need it but if that general concept often comes up in discussions with your domain experts, a rules engine is probably worth having a look at.

guillaume31
  • 13,738
  • 1
  • 32
  • 51