This can be a hard one, since it requires from you to be familiar with Drools.
Consider the condition side of the following rules:
rule "object comparison one"
no-loop
when
$customer1 : Customer( )
$customer2 : Customer(this != $customer1)
then
System.out.println("Rule one - Objects are equal");
end
rule "object comparison two"
no-loop
when
$customer1 : Customer( )
$customer2 : Customer(eval(this != $customer1))
then
System.out.println("Rule two - Objects are equal");
end
Question(s):
Which of the two rules does valid comparison of the two Customer instances?
Which of the two rules is invalid? Why?
Looking forward for your answers dear readers
Resources:
Drools JBoss Rules 5.0 Developer’s Guide July 2009
loading...
Related posts:
- Drools – Working with Stateless Session
Drools (now it is also called JBoss Rules) is an amazing open source framework which allows you to create business rules management system... - Brainteaser: Broken Comparator
Question: The following program returns result “1″, which indicates that first Integer value is greater than the second, why? import java.util.*; public class... - Brainteaser: Broken Case of Inheritance
Consider the following case of inheritance: public class ExtendingHashSet<E> extends HashSet<E> { private int counter = 0; public ExtendingHashSet() { } @Override public... - Drools 5 Case Study 1- Writing DSL for DRL rule
One of the blog readers, who posted a comment in my previous post Drools – tutorial on writing DSL template asked to me... - Rule Engine Stress Testing
I came across a blog by a company called Illation. What those guys do is compare performance of several rule engines available on...

Brainteaser Drools: Testing Objects:
This can be a hard one, since it requires from you to be familiar with Dr.. http://bit.ly/4wykv0
loading...