Drools Sofia Jonsson [email protected]. CADEC2006, Drools, Slide 2 Copyright 2006, Callista...
-
Upload
harvey-hawkins -
Category
Documents
-
view
212 -
download
0
Transcript of Drools Sofia Jonsson [email protected]. CADEC2006, Drools, Slide 2 Copyright 2006, Callista...
Drools
Sofia [email protected]
CADEC2006, Drools, Slide 2Copyright 2006, Callista Enterprise AB
Agenda
• Rule Engines - History/Background.• Problem Definition• Online Loan Application – an Example.
– Writing Rules.– Drools API.
• Summary & Conclusion
CADEC2006, Drools, Slide 3Copyright 2006, Callista Enterprise AB
Rule Engines - Basics
• Evaluates and executes business rules.
• Separates the business logic from the application code.– Compare to a database
• A sophisticated interpreter of if-then statements.– Declarative programming.
CADEC2006, Drools, Slide 4Copyright 2006, Callista Enterprise AB
Rule Engines – Short History
• Expert systems invented during AI research in the 70th and 80th.
• RETE algorithm invented 1979.• Interest has grown in later years.
– JSR 94 – Java Rule Engine API– Open source implementations– Drools part of JEMS (JBoss
Enterprise Middleware System)
CADEC2006, Drools, Slide 5Copyright 2006, Callista Enterprise AB
The Problem
• Increasing demand for agile and flexible applications. – Rapid moving markets– Different countries– Standard applications
• Developers aren’t business domain experts.
• Complex business rules.– Complexity tend to grow over time.
CADEC2006, Drools, Slide 6Copyright 2006, Callista Enterprise AB
Domain Specific Languages
• Used for a very specific problem domain.
• Made possible by Drools’ pluggable semantics framework.
• By specifying your own XML Schema you get rules validation.– Non programmers can edit the
rules!• Combine with default semantics.
CADEC2006, Drools, Slide 7Copyright 2006, Callista Enterprise AB
Domain Specific Languages - Ex
<drools:rule name="Main applicant must be living in Sweden"><condition>
<loan-application identifier="loanApp"> <main-applicant>
<address><country>
<not-equals>Sverige</not-equals>
</country> </address>
</main-applicant> </loan-application>
</condition><consequence>
<reject identifier="loanApp"> <reason>
Main applicant must be living in Sweden. </reason> </reject>
</consequence></drools:rule>
CADEC2006, Drools, Slide 8Copyright 2006, Callista Enterprise AB
Summary & Conclusion
• Consider using a rule engine:– If the application must be flexible.– If domain experts should update the
business rules.– If the application logic is very complex.
• Using a rule engine does not come without a cost.
• Consider development/test process.• Alternative approaches:
– Configurable threshold values– Scripting languages, e.g. Groovy
Questions?