Drools!
Drools, or JBoss Rules is an open source framework that facilitates an easymaintenance of rules. And it comes with a feature called decision matrices which I quite perticularly like. Makes it easy. The best thing is that a decision matrix could be a MS Excel sheet, which means I can have a 2D expression of conditions. It also means that this matrix can be maintained by business analysts and can be created at the time of requirements gathering, instead of being developed by coders at the time of implementation. Gives you a bit of a head start!
Do I use Drools everywhere I have rules? No way! I use it at places that have a high density of if-else kind of statements, otherwise I prefer to use plain old if-elses. The reason is simple, drools does add an overhead, although minimal, of its own. Plus, the logic is decentralised and developers typically have an apprehension dealing with a “different” technology. Anyways, the simplicity achieved via decision matrices scores much higher.
I used Drools recently for a e-commerce function, we had to provide a list of products that a customer could buy based on a number of factors. Had we implemented in the classical if-else manner, it would have been a nightmare to find issues and fix, but decision matrices ensured that we had minimal bugs and any found were easily fixed.
Its super cool, if you haven’t tried it yet, I strongly recommend you work out some time soon :-)