[rules-users] What is the side-effect of using the CE "from"?

Mark Proctor mproctor at codehaus.org
Thu Oct 17 21:01:25 EDT 2013


I don't think any of us have said that 'from' is not good to use. Only that you should understand how it works; with regards to not being reactive, and that it's a linear iteration.

Mark
On 15 Oct 2013, at 04:22, Sonata <plz.write.to at gmail.com> wrote:

> Hi, I remember seeing some best practice and since then it has been in my
> mind that the Drools team actually against the use of CE "from". I do
> however find it really useful and use it alot (and in fact everywhere).
> Could the Drools team clear this up?
> 
> For example, I found it useful because
> 1. When a fact is inserted into the working memory, "from" conditions are
> not evaluated.
> This is good because the fact may not be ready yet (e.g. need updating to
> fill in more stuff to complete it in some rules) and evaluating the fact too
> early may cause exceptions. Using "from" does not suffer from this issue.
> 
> 2. Also, this is good because I dont get unnecessary calls to getters of
> that newly inserted fact for all the rules in the kbase with the class of
> that fact in the LHS because they may not be triggered at the end (e.g.
> filtered by agenda-groups, activation-groups). I put auditing codes on my
> getters to track usage and profiling, hence each call to getters is quite
> expensive for me (elapse time recording, database updating, etc.)
> 
> 3. Once a preceding "from" condition fails, all the subsequent "from"
> conditions will not be evaluated. Again, this is good to save unnecessary
> member accesses to boost performance.
> 
> I know what I dont get using "from" is same pattern node sharing (i.e. same
> condition pattern across rules is evaluated only once when "from" is not
> used), but it seems to me that the pros outweigh the cons.
> 
> Thanks the Drools team for clarifying 
> 
> 
> 
> --
> View this message in context: http://drools.46999.n3.nabble.com/What-is-the-side-effect-of-using-the-CE-from-tp4026368.html
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users




More information about the rules-users mailing list