Re: [rules-users] 'else' in rule

2011-12-07 Thread Spyros Sakellariou
I fully agree with Jim K.  

Writing good business rules (and in my opinion good business rules are loosely 
coupled) is not straightforward and intuitive at the beginning and requires 
from software engineers to develop a different mindset.

Having an ELSE statement could be a deterrent from writing loosely coupled 
rules which is a good practice IMHO.  It reminds me of my early BASIC 
programming days (in the 80's :) where I would end up with horrible spaghetti 
code because of my misuse of the infamous GOTO statement.

I also vote against the ELSE statement.

Spyros 

-Original Message-
From: rules-users-boun...@lists.jboss.org 
[mailto:rules-users-boun...@lists.jboss.org] On Behalf Of JimK
Sent: Tuesday, December 06, 2011 9:08 PM
To: rules-users@lists.jboss.org
Subject: Re: [rules-users] 'else' in rule

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.

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@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users








___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] 'else' in rule

2011-12-06 Thread Wolfgang Laun
The request for else is not as simple as it may seem. (Has the
fundamental difference between a rule and an if statement impregnated
itself?)

Given rules
   when Car(color=Color.RED) then
   when Car(color=Color.BLUE) then
and assuming that we have an else linked to these rules,
how should this else rule fire?

(a) Fire once, when there are no RED or BLUE Car facts ano no other
Car facts at all.
(b) Fire once, when there are no RED or BLUE cars but when there is at
least one Car fact, with any other color.
(c) When there are no RED or BLUE cars, but fire once for each Car
that has any other color.
(d) Irrespective of the presence or absence of RED and BLUE Car facts,
once for each Car that has any other rule.

I am, of course, assuming that rules do not fire mutually exclusive;
hence an else could fire even when one of its associated when
rules should fire.

There is, of course, a thing called decision tree, and it's
legitimate to expect that a decision making system should provide
this technique (just like decision tables). But I think it should
not be tacked onto rules (and you may not even need a Rete engine for
that) - the user confusion is bound to reach new levels.

-W







On 06/12/2011, Mark Proctor mproc...@codehaus.org wrote:
 On 05/12/2011 18:43, ronalbury wrote:
 Please consider the possibility of

 When

 Then

 When

 Then

 Else
 It's already specced up in relational data flows which allows a
 tree-like data flow for your decision:
 http://community.jboss.org/wiki/RelationalDataFlows

 I hope that it, or a variation on it, is delivered in 2012.

 Mark
 --
 View this message in context:
 http://drools.46999.n3.nabble.com/else-in-rule-tp3264337p3562187.html
 Sent from the Drools: User forum mailing list archive at Nabble.com.
 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users

 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] 'else' in rule

2011-12-06 Thread ronalbury
I agree that I jumped in on an effort to define a requirement in terms of a
solution ... however, people generally understand else and otherwise, so
there is some justification in saying you want something to work like them.

I don't care what the underlying mechanism is, but as it stands now we have
to write a rule When (condition-A) and then another rule When not
(condition-A) ... and I think that makes the rules more difficult to
understand and to maintain.

Thanks
   Ron

--
View this message in context: 
http://drools.46999.n3.nabble.com/else-in-rule-tp3264337p3564318.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] 'else' in rule

2011-12-06 Thread JimK
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.

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@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] 'else' in rule

2011-12-06 Thread Mark Proctor
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@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] 'else' in rule

2011-12-05 Thread ronalbury
Please consider the possibility of

When

Then

When

Then

Else

--
View this message in context: 
http://drools.46999.n3.nabble.com/else-in-rule-tp3264337p3562187.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] 'else' in rule

2011-12-05 Thread Mark Proctor
On 05/12/2011 18:43, ronalbury wrote:
 Please consider the possibility of

 When

 Then

 When

 Then

 Else
It's already specced up in relational data flows which allows a 
tree-like data flow for your decision:
http://community.jboss.org/wiki/RelationalDataFlows

I hope that it, or a variation on it, is delivered in 2012.

Mark
 --
 View this message in context: 
 http://drools.46999.n3.nabble.com/else-in-rule-tp3264337p3562187.html
 Sent from the Drools: User forum mailing list archive at Nabble.com.
 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users