On 11/10/05, Hamu, Dave <[EMAIL PROTECTED]> wrote:
>
> What does a calculator have to do with a logger???


I can't speak for Adrian, but if I were going to define a complex (ie
multi-step) calculation in a Drools rule (which I might), and save only the
final result in a domain object (which I might), then I might also want to
log the intermediate steps so that, in the case of failures, I have some
diagnosis.

The event system would not be sufficient to cover that.

In Drools pseudocode:
<parameter>insurancePolicy<parameter>
<condition>insurancePolicy.isValid()</condition>
<condition>insurancePolicy.isFinal()</condition>
<consequence>
float customerValue = insurancePolicy.getVehicle
().getCustomerReportedCost();
float marketValue = insurancePolicy.getVehicle().getMarketValue();
float customerDelta = customerValue - marketValue;
logger.log( "Policy #" + insurancePolicy.getId() + ", Customer Delta: " +
customerDelta );
float premium = PremiumCalculator.annualizedPremium( marketValue );
logger.log( "Policy #" + insurancePolicy.getId() + ", Market Value Premium:
" + premium );
premium += PremiumCalculator.annualizedCustomerDeltaPremium(
insurancePolicy.setPremium( premium );
drools.modifyObject( insurancePolicy );
</consequence>

- Geoffrey
--
Geoffrey Wiseman

Reply via email to