2011-03-29 London - Why do I need the guvnor BRMS?
-
Upload
geoffrey-de-smet -
Category
Technology
-
view
8.412 -
download
0
Transcript of 2011-03-29 London - Why do I need the guvnor BRMS?
drools
Geoffrey De Smet
Why do I need
the Guvnor BRMS?
Guvnor agenda
Use cases
My business requires domain expertise
My business rules change often
Auditable and reproducible
Future improvements
Use cases
I have hammer,
so every problem is a nail?
The myth
BecauseDrools can fulfil business rules
Drools is Turing complete
we should write the entire business layer in Drools?No!
Not imperative like Java, Scala, Groovy, ...
Declarative like RegEx, SQL, JPA-QL, Easier to read, better at scaling
Extract business decisions in Drools that either:Require schooled domain expertise
Change often/fast
Use cases
Financial decisionsMortgages acceptance and interest calculation
Insurances acceptance and fee calculation
Price calculationsPhone/Telecom bills
DiagnosticsPossible diseases based on symptoms
Complex validationCar parts selection
Not a good use case: an XML parserUse Java code for that
Mortgages example
Developers don't like
data input from spreadsheets
Before App 1.0: Mortgages rules in a spreadsheetWhich version/copy of the spreadsheet file?
Which field has the result our application need?
Version 1
Version 2
Mortgage experts like
the flexibility of spreadsheets
Since App 1.0: Mortgages rules in source codeChanging business rules not flexible enoughBusiness rules are hard coded in Java
Invalid: must be a number
Flooded with new improvement requests:when income below 500
when income below 1000 and age above 50
when income below 1% of mortgage amount
Data model in Guvnor
Import POJO jar
or Design the model in Guvnor:
Mortgage experts like the flexibility of Guvnor
App 2.0: Mortgage rules in Guvnor repositoryFlexible like spreadsheetBut fields clearly defined
No spreadsheet versions/copiesAuditable
My business requires
domain expertise
Only mortgage managers
understand mortgage rules
Schooled domain expertise
Are we, the developers, domain experts?Yes, we've been working in this company for year(s).
Do we haveuniversity's degree in economics? No
participated in mortgages conferences/courses? No
years of mortgage customer experience? No
Do we have a clue when the mortgage rules need to change? No
Are we, the developers, domain experts? NoMortgage manager is the domain expert
Domain experts can not read/write Java source code
Communication problemDomain expert can not read it:
for (Mortgage m : mortgages) { for (Applicant a : m.getApplicants()) { if (a.getAge() > 70) { boolean existsGuarantor = false; for (Guarantor g : m.getGuarantors() { if (g.getAge < 60) { existsGuarantor = true; } } // Will they spot the bug in this code? if (existsGuarantor) { m.setApproved(false); } } }}
DRL scales better than this Java code
Domain experts can read/write DRL with Guided Rule Editor
Change
Guided Rule Editor demo video
Demo video
Domain experts can read/write DSL even better
DSL is even easier to read/write
Developers create the building blocks
Domain experts make the building
Source: wikipedia
My business rules
change often
This mortgage rule change must be
released by noon
Deliver changes fast
Business rule change
Not a data changeRequires test and release lifecycle
Logic changes
Not a software changeDelivered in hours, not days
Self-service by mortgage manager
Testing before releasing
Domain experts need to unit test tooExample: mortgage of Erik (75) must be disapproved
Releasing
Release a snapshot of the rules package
Available at URL:http://127.0.0.1:8888/org.drools.guvnor.Guvnor/package/presentationmortgages/mortgagesDeployment
Deployment infrastructure
Auditable and reproducible
Why was that mortgage approved last year?
Auditing
View old revisions of rules
Future improvements
Feed-back welcome
Modules: reuse rules
Module contains assets (rules)Packages will be renamed to modules
Module can depend on other modulesReuse of assets (rules) from other modules
Dependency graph (like Maven/OSGi but simplified)
Mortgage rules
Car loan rules
General loan rules
Customer rules
2.0
1.1
1.1
2.1
Extended release lifecycle
Draft
Test
ReleasedVersion
Immutable (all dependent modules are released)
Summary
Summary
Use Drools and Guvnor
when your business decisions eitherRequire domain expertise
Change often/fast
Q & A
Questions?
Useful links
Website
http://www.jboss.org/drools/
Reference manual
http://www.jboss.org/drools/documentation.html
Blog
http://blog.athico.com/
Mailing lists (forum interface through nabble.com)
http://www.jboss.org/drools/lists.htmlSlides available online
This is the title
Second line of the title
Click to edit the outline text formatSecond Outline LevelThird Outline LevelFourth Outline LevelFifth Outline LevelSixth Outline LevelSeventh Outline LevelEighth Outline LevelNinth Outline Level
This is the chapter title
This is the subtitle