Drools Sofia Jonsson sofia jonssoncallista se Agenda Rule

  • Slides: 9
Download presentation
Drools Sofia Jonsson sofia. jonsson@callista. se

Drools Sofia Jonsson sofia. jonsson@callista. se

Agenda • Rule Engines - History/Background. • Problem Definition • Online Loan Application –

Agenda • Rule Engines - History/Background. • Problem Definition • Online Loan Application – an Example. – Writing Rules. – Drools API. • Summary & Conclusion CADEC 2006, Drools, Slide 2 Copyright 2006, Callista Enterprise AB

Rule Engines - Basics • Evaluates and executes business rules. • Separates the business

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. CADEC 2006, Drools, Slide 3 Copyright 2006, Callista Enterprise AB

Rule Engines – Short History • Expert systems invented during AI research in the

Rule Engines – Short History • Expert systems invented during AI research in the 70 th and 80 th. • 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) CADEC 2006, Drools, Slide 4 Copyright 2006, Callista Enterprise AB

The Problem • Increasing demand for agile and flexible applications. – Rapid moving markets

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. CADEC 2006, Drools, Slide 5 Copyright 2006, Callista Enterprise AB

Domain Specific Languages • Used for a very specific problem domain. • Made possible

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. CADEC 2006, Drools, Slide 6 Copyright 2006, Callista Enterprise AB

Domain Specific Languages - Ex <drools: rule name="Main applicant must be living in Sweden">

Domain Specific Languages - Ex <drools: rule name="Main applicant must be living in Sweden"> <condition> <loan-application identifier="loan. App"> <main-applicant> <address> <country> <not-equals>Sverige</not-equals> </country> </address> </main-applicant> </loan-application> </condition> <consequence> <reject identifier="loan. App"> <reason> Main applicant must be living in Sweden. </reason> </reject> </consequence> </drools: rule> CADEC 2006, Drools, Slide 7 Copyright 2006, Callista Enterprise AB

Summary & Conclusion • Consider using a rule engine: – If the application must

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 CADEC 2006, Drools, Slide 8 Copyright 2006, Callista Enterprise AB

Questions?

Questions?