Drools has come a long way over the past 5 years. Mark Proctor and his team at JBoss have really done an outstanding job bringing Drools up to enterprise grade and making this technology more accessible to the mainstream development community. When I was doing hard core rules development projects using Blaze Advisor (now part of Fair Isaac) and ILOG JRules (now part of IBM) it always bothered me that this technology was way out of reach for most companies due to cost. It seemed ILOG and Blaze/Fair Isaac had become comfortable with an oligopoly and significant price competition was unofficially avoided. The market needed a high quality, low cost competitor to shake things up.
Unfortunately, the open source rules engine space was still very immature. Jess (which was technically not “open source”) was somewhat “academic” with more of a command line orientation and little, if any, tooling. Drools was promising, but it clearly lacked the features that would make it a realistic competitor to commercial solutions. That all started to change in 2005 when Drools was “federated” to JBoss.
Just about when JBoss acquired the development roadmap, version 2.0 of Drools was released. This release dramatically improved performance as it was based upon the popular RETE pattern matching algorithm. Unfortunately, the rules were still authored by hand in XML which was a real deficiency compared to commercial offerings. I found this out first hand when I was doing a small consulting project for Jackson National Life Insurance and conducting impromptu developer training sessions.
Drools is now on version 5 and it has really come a long way. Drools has a solid underlying architecture, clean API, authoring platform, Eclipse-based tooling, rule flow support, decision tables, CEP (Complex Event Processing), and Rule Repository management. If you so desire, you can buy enterprise support from JBoss. I can honestly say that Drools is ready to compete with the big boys.
The presence of this book from PACKT Publishing is a sign that Drools is gaining market share and awareness. The book is well timed and current (it is based upon Drools 5.0). There is another book on Drools called JBoss Drools Business Rules from the same publisher that appears to be geared toward Business Analysts and/or Rule Authors. I have not read that book, but this one is clearly targeted at developers.
Author Michal Bali does an excellent job on this book, in my opinion. He covers most relevant topics in detail, with the exception of Drools Guvnor (a BRMS that is touched upon briefly in Chapter 10, Testing). In the early Chapters, Michal covers some of the basics including “why business rules” and the basics of setup and creating your first rule/execution. My only complaint here is that not enough consideration is given to the key concepts behind rules engines. Things like pattern matching, agenda, refraction, etc. While most of these topics are covered in spots throughout the remainder of the book (including Chapter 12, Performance), I think it would have been a good idea to layout some of the concepts here along with Drools API equivalent. Perhaps a simple explanation of what is actually happening in the Drools Expert when you “fire all rules”.
Over the next couple of chapters, Michal goes into further detail by developing use cases for a banking domain and data transformation. The banking domain setup is also extended later in the book to introduce more complicated concepts. I have to admit that I breezed over the data transformation chapter as I am used to other, simpler approaches to data transformation, usually leveraging purpose built tools. The banking domain model example was pretty good, although I don’t know that I would have modeled the problem in quite the same way. The author’s approach drove me to think too much about the objects involved in the solution rather than focusing on the point of the book – the interaction with Drools. This was a minor issue and ultimately Drools was introduced adequately.
Next, Michal covers the Domain Specific Language capabilities, Decision Tables and introduces Rule Flow. I found it interesting that Michal chose to introduce Decision Tables and Rule Flow in the same chapter as DSL. I thought DSL could have been covered in its own chapter. The same could have been said for Decision Tables. No big deal. Everything was explained clearly. In particular, I thought the Decision Table coverage was solid. It cleared up some confusion I had in a couple of areas.
As we get into the middle chapters, we start getting more advanced. Logical assertions and stateful rule sessions are covered along with serialization techniques. Many readers will not have to deal with difficult serialization issues until scalability becomes an issue. This could have been covered in a later chapter on performance tuning and advanced topics. Chapter 7 covers Drools Fusion, the temporal and event based (CEP) capabilities of Drools. Let me warn you. At this point the content starts to get a little “heady”. Many readers will get lost about now. I wouldn’t let it get you bogged down though. Rules engines can be very valuable in isolating rules without even getting into CEP (for most businesses).
After more detailed coverage of Ruleflow in Chapter 8, a sample application is presented in Chapter 9. Kudos for choosing common platforms (Spring) and persistence APIs (JPA). Frankly, this is what most contemporary Java Enterprise application developers will be dealing with anyway. I also applaud Michal’s usage of previous examples to keep from introducing yet another domain problem. In this way, the Chapter can focus on incorporating the Drools technologies into a conventional web application. I didn’t attempt to run all the code but it did look thoroughly explained.
Chapters 10, 11, and 12 go into Testing, further integration with Spring and build tools like Ant and a deeper dive into the rule engine (for performance tuning, etc.). In the last chapter, there is a much greater explanation of how rules engines work. As I said earlier, perhaps a simplified introduction could have been incorporated early in the book for a context. This would have left Chapter 12 to focus on strictly performance tuning and higher end concepts. Nonetheless, Michal clearly knows what he is talking about in these chapters and provides a solid reference for issues that may come up in production deployments.
Overall, author Michal Bali can be commended for producing a much needed, quality book on Drools. I believe it will help contribute to greater acceptance of Drools and rules engines in general. But be warned. Rules engines are not mainstream for a reason. The concepts can be difficult to absorb as most people (including developers) don’t “think like a rules engine”. For some, this creates a blockage that will never be overcome. The “black box” nature of rule execution is too much for some organizations to handle. However, there is no doubt that certain problems can only be reasonably solved and managed with a rules engine. For those challenged with these problems, this book will help unlock the secrets of using Drools. RECOMMENDED.


#1 by Michal Bali on December 4, 2009 - 9:38 am
Hi Dan, Thank you for this informative review !
Best regards, Michal