Doh !!! That was one of my favorite features :) I found the concept of a "xorGroup" is a powerful replacement for the strategy design pattern. In this case, every consequence is a concrete strategy. Based on the condition, the rule engine selects one consequence (a.k.a a specific strategy) to use.
Regards, Alan Ho -----Original Message----- From: Mark Proctor [mailto:[EMAIL PROTECTED] Sent: Wednesday, April 12, 2006 11:32 AM To: [email protected] Subject: Re: [drools-user] How to express conditional logic via DRL - ? There is no xor-group for 3.0. will be in 3.1 Mark Ho, Alan wrote: > I vote no on having 'else'. > > The switch statement is exactly the same as the "xorGroup" concept in DROOLS > (aka mutually exclusive rules). In DROOLs 3, how do you make a set of rules > to be part of an XOR group ? > > Regards, > Alan Ho > > -----Original Message----- > From: Dmitry Goldenberg [mailto:[EMAIL PROTECTED] > Sent: Tuesday, April 11, 2006 7:57 AM > To: [email protected] > Subject: RE: [drools-user] How to express conditional logic via DRL - ? > > This is actually the reasong I went through- wanting to use Drools as a > script execution framework. Ideally, I'd like to see support for > IF-THEN-ELSE and possibly SWITCH. As of now, I don't see a need for any > other "procedural" constructs but it seems to me that IF-THEN-ELSE would be > an immediate need for our users. It would be nice to have explicit support > for it, rather than a whole chapter in our doc explaining how to achieve it > with multiple rules in a rule-set. > > Thanks, > - Dmitry > > ________________________________ > > From: Mark Proctor [mailto:[EMAIL PROTECTED] > Sent: Tue 4/11/2006 10:46 AM > To: [email protected] > Subject: Re: [drools-user] How to express conditional logic via DRL - ? > > > > Unfortunately I'm finding that many people just cannot adjust to the > declarative and coupletely decoupled nature of a rule engine. The end result > is that Drools is used as a script execution framework. > > Felipe Piccolini wrote: > >> Mark, >> >> I could vote on this, I would vote no to the 'else'. The declarative >> thing about rule engines is that: no procedural code. So if you >> wanna do an 'else' condition you should re-think your rule and chack >> if its well writen. Of course this is just MHO. >> >> :) >> >> Tuesday, April 11, 2006, 6:09:22 AM, you wrote: >> >> >> >>> I thought about adding 'else' but I couldn't decide on the best way >>> to implement it, as there are several possabilities. Also 'else' is >>> not considered declarative, so its a kinda of code smell. I'll llook >>> into this again in 3.1 >>> >>> >> >> >>> Mark >>> Geoffrey Wiseman wrote: >>> >>> >>>> On 4/10/06, Dmitry Goldenberg <[EMAIL PROTECTED]> wrote: >>>> >>>> >>>> >>>>> What is the timeframe for 3.1? Else/else if are very important to >>>>> what we're trying to do. >>>>> >>>>> I can see how I can to the following with the method described by >>>>> Geoffrey: >>>>> >>>>> if (A) then B else if (C) then D endif >>>>> >>>>> I also want to be able to do the following: >>>>> >>>>> if (A) then B else D endif >>>>> >>>>> I imagine that the rule would have to be written as a combo of >>>>> >>>>> if (A) then B endif >>>>> if (!A) then D endif >>>>> >>>>> so that the conditions are complimentary... >>>>> >>>>> >>>>> >>>>> >>>> Indeed, yes, that's how you'd handle it. >>>> >>>> If it does make it into 3.1, that's a good thing in terms of >>>> supporting the way people think, talk, and work in other languages, >>>> but fundamentally, the same capabilities are there now -- they just >>>> require more typing. >>>> >>>> - Geoffrey >>>> -- >>>> Geoffrey Wiseman >>>> >>>> >>>> >>>> >> >> -------------------------- >> Felipe Piccolini >> [EMAIL PROTECTED] >> >> >> >> >> > > > > > >
