Sunday, March 23, 2008

Implement business logic with the Drools rules engine

Ricardo Olivieri has updated his tutorial at IBM developers:
http://www.ibm.com/developerworks/java/library/j-drools/

He has updated his rule syntax from the Drools 2.x XML syntax to the new DRL and goes into a tutorial on how to use the Drools debugging tools in Eclipse.

"Using a rules engine can lower an application's maintenance and extensibility costs by reducing the complexity of components that implement complex business logic. This updated article shows you how to use the open source Drools rules engine to make a Java™ application more adaptive to changes. The Drools project has introduced a new native rule expression language and an Eclipse plug-in, making Drools easier to use than ever before."
......
"As of this writing, the latest version of the Drools rules engine is 4.0.4. This is a major update. Although some backward-compatibility issues exist, this version's features make Drools even more attractive than before. For instance, the new native language for expressing rules is simpler and more elegant than the XML format some older versions use. This new language requires less coding and has a human-readable form.

Another notable development is that a Drools plug-in for the Eclipse IDE (Versions 3.2 and 3.3) is now available. I highly recommend that you use this plug-in to work with Drools. It simplifies the development of projects that use Drools and will improve your productivity. For instance, the plug-in checks your rules file for syntax errors and offers code completion. It also allows you to debug your rules file, potentially reducing debugging time from hours to minutes. You can add breakpoints to your rules file, which lets you inspect the state of the objects at specific moments during rule execution. This gives you information about the knowledge — a term you'll become familiar with later in this article — that the rules engine possesses at a particular moment in time."