Drools JBoss Rules 5.0 55
RickJWagner writes "Drools (sometimes called 'JBoss Rules') is a Business Rules Engine and supporting ecosystem. Drools, like other BREs, promises to lower the barriers to entry for application programming. Armed with this book, can a Business Analyst be used to write application logic? I don't believe so, and I'll tell you why." Keep reading for the rest of RickJWagner's review.
Business Rules Engines, especially those based on the Rete algorithm, strongly favor rules written in 'if/then' format. (Sometimes the marketers will call this 'when/then' logic.) The basic premise is that you write your rules as a series of rules that individually specify matching logic for some objects you make available to the engine, then you specify what to do if any of the objects match your conditions. Example "IF there is a customer with age > 60, THEN allow senior discount". That's the marketing promise, anyway.Drools JBoss Rules 5.0 Developer's Guide | |
author | Michal Bali |
pages | 320 |
publisher | Packt Publishing |
rating | 7/10 |
reviewer | RickJWagner |
ISBN | 1847195644 |
summary | Guides you through all of the features of Drools, such as dynamic rules, the event model, and Rete implementation with high performance indexing. |
This book does a great job of showing you how to build a banking application, complete with validation, data transformation, and reporting functions. Each of these are implemented using Drools, of course, and workable code is provided at every step. The author takes care to explain nearly every line of code provided and highlights important classes and features as they occur. I think the author did well here.
Writing business rules is quite a bit different than writing logic in a language like Java or C++. I'd compare it more directly to writing SQL-- you're declaratively specifying which objects (out of a group) you want something to happen to, so you're thinking in terms of matching logic rather than ordered steps in an algorithm. You also don't always have complete control over the order in which your rules are fired, so it's not like garden-variety coding where it can be treated like a 5-step recipe. It just takes a different mindset. Once you're used to it, things are easier to understand, and this book can help. (By the way, I've fooled around with BREs for about a decade now, and support a production application that uses Drools, so I'd consider myself moderately skilled in BRE usage.)
In the course of writing the banking application the book is anchored upon, the author occasionally makes design decisions that are specific to doing things "The Rule Engine Way". One example is the use of 'global' facilities for validation reporting. The author might have chosen to implement this another way, but chose what he considered the best path and briefly explained his reasoning in making the choice. That's exactly the kind of thing that I think a BRE-literate reader would find of value-- expert insights into how to use this tool, not mere explanations of syntax, etc. Unfortunately, these insights were relatively few in nature and not highlighted where they were presented, so they might not be apparent to readers that aren't already thinking in the BRE way.
One thing the book glossed over that I wish was given more coverage is Guvnor, the Drools Business Rule Management System. Basically, a BRMS is a web application used to change existing rules, write new rules (provided they have been pre-templated by a rule author, usually), and version the rules. I'm told this is one of the key differentiators between Drools and commercial offerings like IBM's JRules, so it's a little disappointing that it was given virtually no coverage in this book.
As the author fleshes out the banking application, we encounter a little scope bleed as the reader is introduced to iBatis, Spring and Tomcat. While I see how these are necessary for the provided application, I viewed them as distractions and potentially barriers to successful implementation for some readers. To counter that, I offer the author kudos for covering a multitude of Drools facets like Domain Specific Language inclusion, Complex Event Processing, and rule ordering through "Drools Flow". All these are valuable tools in the Drools user's toolbox and they are given adequate coverage.
As I hinted at in the opening paragraph, marketers of BREs love to show demonstrations where rules are written in shocking clear 'if/then' syntax. These rules are purported to control powerful application logic and can be maintained by low-cost business analysts. Is this reality with Drools? No, I'm afraid not. It's also not true with JRules, Blaze, or any other Rete-powered BRE. What marketers will show you is how easy rule maintenance can be-- but they're not showing you how difficult things can be when your logic doesn't neatly fit the 'if/then' paradigm. For example, commercial vendors love to show insurance logic where they offer rules like 'IF the driver's age is over 25, THEN give them a discount'. Next time you see one of those, ask the marketer to show you something along the lines of 'Calculate the average age of the drivers in the household'. Notice how that doesn't say 'IF'? Requests of this type will typically require a skilled rule author, not a business analyst copying from a rule template. This type of logic does not play to the strengths of the engine. Actually, implementing this type of logic can be fiendishly difficult-- that's the reason BRE developers are among the best paid of application developers (Check Dice or Monster.com). I say all this to let you know BRE usage sometimes is easy, sometimes is really hard. In a workspace like that, I like to have advice handy from a multitude of providers, and I'll be happy to add this book to my reference collection. I just wish there were more highlighted best practices in this book to help the user leverage the author's expert experience. (By the way, there are a few more books on rules engines available, but most all of what I've seen is truly awful. I do believe they were written by business analysts, and probably ones who have never actually written an application powered by a BRE. I do not find that fault with this book.)
So, what's the verdict? I'm glad I read this book (twice, to make sure I got everything) and would recommend it to anyone using Drools. If you're not yet a Drools user, I don't think this book offers enough remedial material to effectively help you get on board-- for that I recommend the excellent documentation offered online with the product. (By the way, I hope you like cheese. The Drools doc authors seem to have some sort of cheese fixation, so references to cheese are plentiful.) For a Drools user like me, this book offers a view at parts of the toolkit I hadn't yet used and a view of how an expert user might go about designing an application. I'll call it a keeper.
You can purchase Drools JBoss Rules 5.0 Developer's Guide from amazon.com. Slashdot welcomes readers' book reviews -- to see your own review here, read the book review guidelines, then visit the submission page.
drools, really? (Score:2, Funny)
You open-source guys need to pick some better names.
Re: (Score:2)
Re:Woot! (Score:4, Insightful)
Re: (Score:1)
So does positive require that he give it a 10/10 or something?
Re: (Score:2)
Re: (Score:2)
For it to be a shill, yes.
Why? The importance of shilling is to get the advertising out there. If you were to constantly give things 10/10 you would eventually just get filtered out as spam. A clever shill will be far more subtle.
Re: (Score:2)
Re: (Score:2)
Re: (Score:2)
A clever shill will create a new user account when their old one is being filtered.
A clever shill would never get filtered. If you are being filtered and have to make a new user account to continue shilling means you're a huge failure.
They will not submit a review whose summary states, "Armed with this book, can a Business Analyst be used to write application logic? I don't believe so, and I'll tell you why."
And then you ignore the part where it says the book is recommended for Drool users and that it's a keeper. It's hilarious how you focus on a single sentence to claim this is a negative review and then ignore the fact that he's telling people to buy the book.
Re:Woot! (Score:4, Informative)
Silly question (Score:5, Funny)
No, however, they can be sliced open like a tauntaun and used as a sleeping bag, if you happen to be trapped at night, out in the open, on an ice planet.
Re:Silly question (Score:4, Funny)
No, however, they can be sliced open like a tauntaun and used as a sleeping bag, if you happen to be trapped at night, out in the open, on an ice planet.
....and I thought they smelled bad on the outside!
Confused? (Score:5, Informative)
Take a look at this to see what Drools can really be used for:
http://www.redhat.com/f/pdf/jbw/amollenkopf_430_applying_drools.pdf [redhat.com]
It's quite powerful when used right..
Re: (Score:1)
Re: (Score:2)
Unless LINQ expresses your intent better, and in the process renders the formal looping construct redundant.
Non-programmers should not program (Score:3, Insightful)
Re: (Score:2)
We use drools for quite a lot of stuff, some of it is high level and not for the KAMs, but we expect them to maintain decision tables for our core engine based on their sales.
The "programming" of rules can be quite daunting, but using the spreadsheet option, it's a walk in the park.
Sigh... (Score:2, Interesting)
Re:Sigh... (Score:5, Insightful)
Re:Sigh... (Score:4, Insightful)
J2EE is also awesome for building extremely bloaty applications that require 50% more servers than something running a non-bloated solution.
The power of Java/J2EE is that it produces acceptable results when used by the small sigmas of the developer population that makes up the largest bulk of the area under the standard distribution curve. Yeah, it's wordy, yeah, it's hungry, but the Fortune 500 can hire people to work on it and they can afford the hardware and connectivity. And when their app needs to scale, it can.
The top decile can continue to argue the virtues of Rails vs. Catalyst vs. D'jango, and that's fine, but it's also different. The LISP web hackers are making fun of them anyway.
Call me when you want (Score:2)
to implement say a stock exchange where you have to deal with 100's of thousands of business messages a second with absolute 100% reliability and fault tolerance. Call us whatever names you like, but in this business you walk the walk and bullshit lasts 9 seconds. There really is no other tool out there that lets you build REAL line of business application systems with anything like the scalability and with anything like the efficiency of either manpower or hardware. Anyone who doesn't know that lives under
Re: (Score:2)
The built-in functionality of Visual Studio is pathetic when compared to that of Eclipse.
Re: (Score:2)
I agree with you man it takes a crap load of hardware to run it thus my passionate love for it.
Re: (Score:1)
I now write massively distributed Java server apps which include automatic deployment and load-balancing, abstracted distributed file systems and distibuted scalable DBs. We use a 'servlet-style' web application framework - but not servlets. We have something tighter, faster and far more scaleable (took a couple of we
No offense, but... (Score:2)
It's pretty easy to Google [lmgtfy.com] it just from the information [wikipedia.org] given.
Re: (Score:2)
Re: (Score:2)
Awesome, I love Brule's Rules! (Score:1, Redundant)
...oh wait. :(
Why RTFA? (Score:2)
Why RTFA?
can a Business Analyst be used to write application logic? I don't believe so
You either agree with this statement, or you're a BA yourself, or worse.
Fiendishly difficult (Score:2)
Calculate the average age of the drivers in the household ... implementing this type of logic can be fiendishly difficult
Really? Or was your example too simplistic?
Either the data is readily available or you need a human to obtain the data. Add, divide... pretty easy, no? What am I missing?
Re: (Score:2)
I think that the point that the author was making is that the logic contains IF, THEN, and comparisons, not add and divide. It may be that the business analysts do not understand math.
Re: (Score:1)
Doesn't IBM JRules have BRMS... (Score:1)
Re: (Score:1)
BREs can't solve every problem (Score:3, Informative)
Having worked on a project from conception through production, written in JRules, I'd have to agree that the marketing examples for rules engines are way oversimplified.
You're right, they present simple if/then logic as being applicable to every problem. As you demonstrate with the "compute average age" example, this can quickly break down. The problem is that it's hard or impossible to maintain context on an object from rule to rule. BREs expect each rule to be independently applicable to an object. This works in some domains, but many business rule flows require that context be maintained throughout the flow.
Another problem is database access. BREs expect that the object will be pulled completely from the database at the start of execution, and no further database interaction is required until the object is finalized and persisted. Again, this is way too simple for many business requirements.
To extend your insurance example, ask how you would calculate a driver's premium based on a code associated with the object. There can be millions of codes for which the premiums may change at any time, so they must be pulled from a database at execution time.
Extend this to similar db transactions on nearly every decision in the tree, and execution quickly bogs down. Yes, you can cache a certain amount of this data, but with a large enough set, the model breaks. Multithreading and parallel processing will buy some speed, but only so much. If database transactions are dependent on path of execution in the tree, the BRE model will have problems.
Perhaps the reason rules authors are so well paid (if this is true) is perhaps because they're often required to use the wrong tool for the job. If I were required to use a sledgehammer to chop down trees I would expect better pay.
Re: (Score:1)
Re: (Score:1)
It would be one step in a process that involves hundreds of steps.
So why not calculate the average at data collection time and store it alongside the other data? Rules change. Often. It's average age this week, but last week it was absolute age of drivers. Your programmer was on holiday during the change (which was told to the business rules team two days before going live date). Your rules engine needs to be able to do calculations.
So you submit facts you've gathered (from customer, credit agencies, etc) i
If you're really interested in Drools... (Score:2)
...and you're in the Bay Area, head on down to the last day of Rulesfest, which includes a Drools bootcamp:
http://rulesfest.org/html/bootcamps.html [rulesfest.org]
If you want dummies to understand it, (Score:2)
don't compare and contrast with C++ or Java. How about something more familiar?
Let's see, "you're declaratively specifying which objects (out of a group) you want something to happen to, so you're thinking in terms of matching logic rather than ordered steps in an algorithm. "
Hmm.
<div class="group">object1</div>
<div class="group">object2</div>
Aha, now I get it!
I don't believe it (Score:2)
The Packt book I bought - Spring Security 3 - is single handedly the worst technical book I've ever owned. The XML build scripts don't even have matching closing tags. When I told the company, they offered me half off on a PDF and asked me to stop telling people in public.
7/10 my ass. This is a slashvertisement.