The nice folks on the Drools blog pointed me to an article today called Implement business logic with the Drools rules engine. This article was written by Ricardo Olivieri of IBM. Richard does a nice job of walking through both the basic case for using a business rules engine (BRE). I feel compelled to make a couple of points, though, before recommending it to you:
- Richard’s example only discuss decisions and the management of decisions implicitly.
His example revolves around a decision, as most good rules examples do, but I would have called out the focus on the “which tests does this machine require” decision. Note that it is a decision for a specific machine that is being automated and this transactional focus is typical.
- While it shows the power of declarative programming it does not show the user engagement
One of the many reasons for using business rules is the power of the approach to bring business analysts and business users more directly into the process. While the Drools syntax is nice and declarative, it is a little user-hostile still. I am not sure the text engineers would feel comfortable editing the rules themselves. In general users need some “protection” from this level of detail to get engaged and this typically means templates and custom UIs as discussed here in our wiki.
- The importance of decision management did not come through
While Richard talked about change and agility, he did not put much focus in the article on the ongoing management of the decision and the rules that support it. In most implementations this rapidly becomes the driving force for using business rules, not the initial replacement of code with something declarative.
All that said it is a nice worked example and worth a read for anyone with a basic Java background who wants to see how Drools works. It also has sample code for you to download. Enjoy.