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...
Sent from the Drools: User forum mailing list archive at
Nabble.com.