1 / 69

Michael Neale michael@michaelneale jboss michaelneale

Michael Neale michael@michaelneale.net www.jboss.org www.michaelneale.net. Project history. JBoss/Red Hat. History of Rule Engines. 70s: Mycin/E-Mycin 80s: CLIPS + many more (expert systems) ‏ 90s: BRMS (Ilog, Fair Isaac) ‏ (business rules management) ‏. Practical rule engines.

Download Presentation

Michael Neale michael@michaelneale jboss michaelneale

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Michael Neale michael@michaelneale.net www.jboss.org www.michaelneale.net

  2. Project history

  3. JBoss/Red Hat

  4. History of Rule Engines 70s: Mycin/E-Mycin 80s: CLIPS + many more (expert systems)‏ 90s: BRMS (Ilog, Fair Isaac)‏ (business rules management)‏

  5. Practical rule engines Humorous introduction Thanks to Thomas Meeks (it tries to be funny)‏

  6. What are rule engines for? Add rules == expert system (a system that emulates a domain expert)‏ BRMS == Business Rule Management System (central management of changing business rules)‏ Decision services (automated decisions, decision support)‏

  7. No really? What are they good for? Some example users: HR (coping with multiple awards)‏ Transport (monitoring sensors)‏ Mortgage products (> 4000 rules)‏

  8. Drools is an engine++ IDE (developer tooling) – debugging Web based tooling (analysis – BRMS)‏ Deployment tools CEP/Stream processing (future)‏ Testing and analysis tools (next release)‏ Multiple authoring paradigms: DRL, DSL, XLS (decision tables), PNL, Rule Flow

  9. A quick visual tour...

  10. Dev tools:

  11. IDE

  12. Web tools:

  13. rule editing

  14. DSLs for i18n

  15. Integrated testing

  16. Logic Analysis

  17. Climbing the peak... Helps simplify complicated logic Lowers the cost of changing business logic Usually very fast Basically a business logic framework

  18. Not another framework !

  19. No silver bullet Rule engines are a complexity, use only as needed, otherwise, grrr.....

  20. So, when to use one? Complicated logic (not 1+1 = 3 for large values of 1)‏ Changes often (whatever that means)‏ Traditional approaches are a challenge Domain expertise is readily available

  21. Don't use for a shopping cart Don't use on applications with simple business logic If the logic is complicated but will never (ever) change, might not need it. Easy logic, changes often? try : Scripting, Lookup tables etc...

  22. Optimisation and speed

  23. RETE Latin for “net”. As in network, or graph. Performance is theoretically independent of the number of rules in the system. Hint: its really a stateful optimisation technique, no-one expects you to know it (or care).

  24. Example Lets use rules to solve a real world scenario Well, real, perhaps if you are a pirate

  25. A Domain expert Yarr, Launch every ZIG ! (Captn' Domain Expert)‏

  26. if (us.somebodySetUsUpTheBomb()) { for (Zig zig : us.getZigs()) { zig.launch(); // for justice! } }

  27. Sally the Mechanic Zigs should not launch without their weapon system...

  28. Which of course are... Atomic Kittens

  29. if (us.somebodySetUsUpTheBomb()) { for (Zig zig : us.getZigs()) { if (zig.hasAtomicKitty()) { zig.launch(); } } }

  30. Johnny the Regulator Zigs must have been inspected in the last 24 hours to launch!

  31. if (us.somebodySetUsUpTheBomb()) { for (Zig zig : us.getZigs()) { if (zig.hasAtomicKitty()‏ && zig.isInspected()) { zig.launch(); } } }

  32. Johnny the Regulator Oh, and rule 23.43-57a#32.57 explicitly states that no more than 10 Zigs can fly at a time!

  33. if (us.somebodySetUsUpTheBomb()) { int i = 0; for (Zig zig : us.getZigs()) { if (i == 10) { break; } if (zig.hasAtomicKitty()‏ && zig.inspected()) { zig.launch(); i++; } } }

  34. Capt'n Domain expert Arr! Only 10!? If a Zig be shot down, launch more!

  35. Hmmm... We could keep checking every Zig's status in an infinite loop. We could implement the observer pattern on Zigs (when they explode, they tell someone). etc... <snore> Lets stick with the loop for the example

  36. int i = 0; while (us.somebodySetUsUpTheBomb()) { for (Zig zig : us.getZigs()) { if (zig.hasExploded()) { us.getZigs().remove(zig); i--; continue; } if (zig.hasAtomicKitty() && zig.inspected()‏ && i < 10) { zig.launch(); i++; } } }

  37. Sally the Mechanic If those Zigs get beat up, they should land so I can fix them! And don't try to launch them while I'm working on them!

  38. int i = 0; while (somebodySetUsUpTheBomb()) { for (Zig zig : us.getZigs()) { if (zig.needsMaintenance()) { zig.land(); mechanic.startFixing(zig); i--; continue; } if (zig.hasExploded()) { us.getZigs().remove(zig); i--; continue; } if (zig.hasAtomicKitty() && zig.inspected()‏ && i < 10 && !zig.inMaintenance()) { zig.launch(); i++; } } } Hint: Most likely “inMaintenance” check will be forgotten, the first time....

  39. Johnny the Regulator I forgot to mention that rule 23.43-57a#32.57a explicitly states that all Zigs can fly if you fax form 453.438-347#B in triplicate

  40. Capt'n Domain expert Arr! That form takes hours to fill! Arr! Launch 10 until we fax it, then Take off every Zig!

  41. int i = 0; while (somebodySetUsUpTheBomb()) { form.asyncFillOutAndFax(); for (Zig zig : us.getZigs()) { if (zig.needsMaintenance()) { zig.land(); mechanic.startFixing(zig); i--; continue; } if (zig.hasExploded()) { us.getZigs().remove(zig); i--; continue; } if (zig.hasAtomicKitty() && zig.inspected()‏ && (i < 10 || form.isFaxed()) && !zig.inMaintenance()) { zig.launch(); i++; } } }

  42. Johnny the Regulator We just changed the rules! All Zigs must be pink to fly

  43. Sally the Mechanic Paint them pink!? That will take months! We have thousands!

More Related