There is no way the irreconcilable difference between a production
rule system (PRS) and functional programming (FP). The former is based
on state and mutable data, in facts and even temporary objects
resulting from evaluation (no matter how the underlying engine works).
There is one (frequently repeated) step in the PRS execution logic
that benefits from FP ideas: RHS evaluation. It's best practice, even
mandatory, to avoid side effects in any methods invoked during this
step. OO programming (as in Java) invites (nominal) violations of this
rule, e.g., during an accumulate that isn't written recursively (and
the current interface prescribes otherwise), but they don't matter
since it is "below the counter".
Removing state and mutability is frequently acceptable - Drools has
sequential mode where facts cannot be changed. However, with all the
apps I've seen and written, the rule design patterns I've identified
and documented state in facts is too valuable.
-W
On 07/03/2013, Matteo Mortari <matteo.mortari(a)gmail.com> wrote:
Ciao everybody, I have a question I would like to submit to this
community,
given Drools is my preferred choice for Expert Systems :)
A quick background: I'm not an Expert Systems / Rule engines expert, but
I'm a happy power user "of Rules" since my CS Engineering thesis, a paper
published, and used it with happy results at work and hobby projects.
Currently boarded on a new project with Rules+Processes at work, and still
very happy, so happy, I'm using Drools again in a new hobby project.
[semi-brag-mode off]
Now, in recent times, I cannot ignore what (apparently) is a strong
renaissance of Functional Programming, specifically all this momentum which
Scala and Java 8's Lambda's are getting.
The Question I'm asking myself: is there a specific, or few, areas where
Functional Programming could actually benefit Expert Systems so much to
actually spawn new paradigms of writing Rules? Or benefit in a new
generation of the Rete algorithm?
Or actually, Functional Programming will spawn a completely different
paradigm of system which will go beyond Expert Systems the way are designed
today?
Ignore my rant if you feel it's too generic, but I really wanted to seize a
chance to ask the question to this community :)
Thank you for your feedback,
Ciao,
Matteo