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-bounces(a)lists.jboss.org [mailto:rules-users-bounces@lists.jboss.org] On
Behalf Of JimK
Sent: Tuesday, December 06, 2011 9:08 PM
To: rules-users(a)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(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users