Nov 17

In JBoss Drools you can use Functions to simplify rules and to DRY:

function int monthlyPayment(Money initialMonthlyPayment) {
    return initialMonthlyPayment.times(0.75);
}

We used this technic for some little helpers. We unit test all our rules and everything seems to be fine until our customer did some more monkey testing. He claimed that some rules worked once but fail now. After some root cause analysis we found a very strange bug (JBRULES-2749). Rules won’t fire! Luckily we found this bug before our go live.

Don’t use Drools functions until this issue is solved. Instead use a static method in a helper class.

Drools is really a cool rule engine, please vote for JBRULES-2749.

Tagged with:
Sep 15

Do you use Drools, a very popular rule engine? Do you use IntelliJ IDEA? Then this post might be interesting for you!

update: Since IDEA 12 there is built-in Drools support

Peter Gromov showed me the power of custom file types. Another secret I discovered in the world’s greatest Java IDE.

I followed his advice and created a custom file type for DRL files.

Nice, isn’t it? Besides the coloring you get:

  • basic code completion (all configured keywords)
  • support braces, brackets, parens, string escapes
  • 4 different keyword sets (4 different colorings)
  • Comment/Uncomment lines (Mac: Command-/)
  • Block-Comment/Uncomment (Mac: Control-?)

You can easily import this IDEA drl file type with File > Import Settings... I didn’t tried to import them, so back up your settings please.

You want more? Go and vote for IDEA-24348.

Tagged with:
preload preload preload