“Managing Business Logic
with rule based
technologies”
Michael Neale
OSDC – Sydney - 2008
And a little about me:
“first Australian JBoss Employee”
Was lonely for a while (but now we are part of Red Hat
family !).
Rules/Expert Systems
•Were once delivered as expert system shells
•Extract logic “out of code”
•Explicit rules
•“On the fly” changes to rules
History
•1970's – MYCIN
•Production Rules
•Generalised into a “shell” that can be re-used
•90's - “business rule engines”
Production Rules
•if/when <condition> then <action>
•Logic programming
•Logical chaining
•
•(you may remember prolog)
Why bother?
•“Greenspunning”
•Have been in use for some time
•Being declarative is (often) good for you
When to use
•Domain expertise available
•Dynamic changes to rules separate from SDLC
•One point of truth for “the business rule”
Pattern Matching
•Pattern matching is central
•... but a quality “model” is needed
•results in looser coupling
•... which means longer term change tolerance
Engines
... inference or scripting engine?
Scripting approach
Simple, easy
Higher order logic
•Higher order logic
•Dealing with knowledge bases with lots of “static” data
•RETE algorithm (an optimisation)
Rete
Changed facts
Stable facts
Rules
“Agenda”
Rules finding facts or facts finding rules?
Example applications
•Underwriting, pricing insurance
•Real time traffic monitoring and recommendation
•Mortgage pricing
•Claim (insurance) process legal compliance
•VISA, Mastercard fraud detection
•Logistics routing
User interface
“visual metaphors”
A dose of reality
•Over-promising in the 90's
•Underdelivering
•“who needs a programmer”
CLIPS
Thanks NASA !
(defrule engine-sluggish ""
(engine-sluggish yes)
(not (repair ?))
=>
(assert (repair "Clean the fuel line.")))
(defrule engine-misfires ""
(engine-misfires yes)
(not (repair ?))
=>
(assert (repair "Point gap adjustment.")))
Clips integration
•Shell or command line style
•Detailed C API and sample code
•clips.h
•Embed it in your native apps
Drools
•Targets JVM (also a .Net port) at present
•Originated from codehaus community (now jboss)
•Has developer + analyst tools
Drools example
rule engine-sluggish
when
Engine(sluggish = true)
not Repair()
then
insert(new Repair(“clean fuel line”))
end
rule engine-misfires:
when
Engine(misfires=true)
not Repair()
then
insert(new Repair(“Point gap adjustment”))
end
Thanks...
Questions?
michaelneale.blogspot.com
twitter.com/michaelneale
http://friendfeed.com/rooms/osdc

Osdc Michael Neale 2008