Wednesday, February 21, 2007
A good rule engine can be great when dealing with "conflicting" requirements. You can reverse the logic and show WHY something happened.
State machines really excel in event driven environments (like your J2EE app). Especially when complexity can get out of hand quickly.
Why use these. Well besides that its an established method and people might be able to understand your code...maintainability is enhanced. A new line (or modifying a line) in a state table is pretty easy. Modifying a rule (with Prolog) is much easier than diving into a rats nest of deeply nested if/elseif/else statments.
Why don't we do this more?
I found a great explanation for a rules engine. The example used is highly approved by this site.