I'm doing something like this:

n_points = ( (score - mean-all-scores) + (score - mean-group-scores) / 2) *
fiddle-factor

and generating a description for users who want to see why a particular
number of points was awarded.

This is a bit of an artificial example, because I don't want to go into
details without checking with my boss! But hopefully you can see why I'm
thinking of using a rule engine - if the business changes the way the
formula works it would be useful for them to have it defined in a rulefile.
And you can see how the calculation relates to a logger, hopefully.

I have already had to make changes to some formulas that went beyond just
the values of fiddle factors, too, and so it has been very useful doing
this in a rulefile already. I've been using JRules previously - now I'm
keen to switch to Drools (or at least to try it out in a test environment).



                                                                                
                                                                 
                      "Hamu, Dave"                                              
                                                                 
                      <[EMAIL PROTECTED]         To:      
<[email protected]>                                                      
         
                      .com>                    cc:                              
                                                                 
                                               Subject: RE: [drools-user] 
should we be logging inside a rule consequence at    all?              
                      10/11/2005 15:58                                          
                                                                 
                      Please respond                                            
                                                                 
                      to user                                                   
                                                                 
                                                                                
                                                                 
                                                                                
                                                                 




What does a calculator have to do with a logger???

If logging of an event is part of your workflow and you do things like:

1) Enter Order
2) Validate Order
3) Fulfill Order
4) Complete Order
5) Archive Order

Then you simply log those events by having the logger triggered by the
methods that do the work.  In our case we have a framework that comes
complete with Log4J and the logger is accessible to every method.
Verbosity and the extent of logging is controlled by the method that
does the work.

Also, if you want to log the activation of each rule or certain rules,
Drools has hooks to allow you to monitor the activation of rules.

- Dave


-----Original Message-----
From: Adrian Bigland [mailto:[EMAIL PROTECTED]
Sent: Thursday, November 10, 2005 8:45 AM
To: [email protected]
Subject: Re: [drools-user] should we be logging inside a rule
consequence at all?

Thanks guys,

this sort of advice was what I was after.

My problem is that I'm using the rule engine to do a calculation. I'd
like to be able to change the calculation easily after deploying the
code so a rule engine looks like a good fit. The calculation is a
business-defined bit of info. I also want to describe/log the
calculation, which I am doing in the consequence.

If I put the calc and the logging in a class, I lose the ability to
change it without re-releasing the supporting code...

That's why I'm asserting a logger etc.





                      Mark Proctor

                      <[EMAIL PROTECTED]         To:
[email protected]

                      us.org>                  cc:

                                               Subject: Re:
[drools-user] should we be logging inside a rule consequence at all?

                      10/11/2005 14:31

                      Please respond

                      to user









Good advice. I further advocate that the real business logic should
happen in methods outside of the consequence, the consequence is just
the minimal plumbing to call methods to get the job done. A consequence
is declaring what you want done, not how you want it done - although
thats just a guide line.

Mark
Chalakanth Reddy wrote:
> Our team is new to Drools too and we are in the process of figuring
> out coding guidelines for the rules.
>
> We decided never use a logger inside the consequence.
>
> The consequence must express business rules only and there should be
> no extra "plumbing" type code.
>
> Something like this ....
>
> <rule>
>       <condition>order.isCompleted()</condition>
>       <consequence>workflow.archiveOrder(order)</consequence>
> </rule>
>
>
> The logs from a WorkingMemoryEventListener, and the logs from the Java

> classes that actually implements the business rule statements should
> give us all the information we need.  Or so we hope.
>
> Does this make sense?
>
>
> This communication, including any attachments, may contain privileged
> or confidential information.  It is intended for a specific individual

> and purpose and is protected by law.  If you have received this
> communication in error, please immediately notify me and destroy the
communication.
Any
> wrongful interception, disclosure, copying or distribution of this
> communication, or the taking of any action based on this communication

> by anyone other than the intended recipient is strictly prohibited and

> punishable under federal law.
>
>
>
>






**********************************************************************
This e-mail and any attachment is intended for the named addressee(s)
only, or person authorised to receive it on their behalf. The content
should be treated as confidential and the recipient may not disclose
this message or any attachment to anyone else without authorisation.
Unauthorised use, copying or disclosure may be unlawful. If this
transmission is received in error please notify the sender immediately
and delete this message from your e-mail system. Any view expressed by
the sender of this message or any attachment may be personal and may not
represent the view held by First Choice Holidays PLC and its
subsidiaries. All electronic transmissions to and from First Choice are
recorded, may be monitored and are scanned for viruses and content.
E-mails containing viruses will be deleted without notification. Whilst
we maintain virus checks on inbound e-mails we accept no liability for
viruses or other material introduced with this message.

All companies form part of the First Choice Holidays PLC group of
companies.

First Choice Holidays PLC Company Registration No: 48967 (England)

Registered Office: First Choice House, London Road, Crawley, WestSussex
RH10 9GX
**********************************************************************



Reply via email to