The decision tables are another form of human-readable rules that is useful when there are lots of similar rules with different values. Rules that share the same conditions with different parameters can be captured in a decision table. Decision tables can be represented in an Excel spreadsheet (the .xls
file) or a comma-separated value (the .csv
file) format. Starting from Version 5.0, Drools supports web-based decision tables as well. They won't be discussed in this book; however, they are very similar. Let's look at a simple decision table in the .xls
format.
The screenshot shows one decision table for validating a customer. Line number 10 shows four columns. The first one defines the rule name, the next two define conditions, and the last one is for defining actions/consequences. Lines from 11 to 13 represent the individual rules; one line per rule. Each cell defines the parameters...