[rules-users] 'else' in rule

Mark Proctor mproctor at codehaus.org
Tue Dec 6 14:21:14 EST 2011


On 06/12/2011 19:08, JimK wrote:
> My $.02
> I'm early in my use of Drools and Rules and struggled at first with the lack
> of ELSE.  At first I would frequently feel "an ELSE would be prefect here".
> After awhile I believe that NOT having Else is a good thing.   As I get
> better with writing rules I find that most of the times when I think I need
> an Else it usually means I should take a closer look at the rule.
>
> If I have a true Else situation for me I put the two rules one right after
> another. In these situations I think it is better to have to write the
> "ELSE" rule as effectively a NOT of the WHEN rule then having an ELSE fall
> through. Isn't that much extra coding and usually gives me pause to give it
> one more evaluation to see if this is a true ELSE or a new rule with similar
> criteria from the When.
>
> Many times the ELSE covers too many possibilities that should be explicitly
> checked and for me at least tells me I might not have fully broken the
> requirements down.  As another posting indicates the complexity of
> implementing it I also wonder about the performance hit the logic to allow
> for an ELSE would add.
>
> With my current understanding of business rules and drools I would vote
> against an ELSE.
What is currently in early propsoal stage is a sort of directional data 
flow concept:
http://community.jboss.org/wiki/RelationalDataFlows

While there is no 'else' keyword you can control the direction of flow 
from failure of a tuple to propagate, this allows you create tree like 
data structures to handle the flow, which can solve "else" like situations.

For me the most interesting and useful construct there will be the 
"case" statement, which I find I often need.  I'm looking to be able to 
better handle signal processing type problems, that people might use 
languages such as erlang for.

Mark
>
> Jim K.
>
> --
> View this message in context: http://drools.46999.n3.nabble.com/else-in-rule-tp3264337p3565278.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