I'm a Drools newbie with a design dilemma...
Apologies in advance if my question is too abstract or too general.
Basically my question is:
- Do you often find yourselves feeding Drools with "tuples" (multiple
"assertObject"), and performing "joins" on them ?
- Or do you pack everything into a single java object (single "assertObject"),
which already encapsulates all related data ?
For example, assume you have 2 types of entities:
- User (with "ID" and "address")
- Account: (has "balance". Belongs to a single user).
Now, the "tuples/join" approach is something like:
- assertObject( someUser)
- assertObject (someAccount)
- Write a rule with 2 parameters: (user,account)
And a "join": < java:condition > account.ownderId==user.id
And the approach of "packing everying into 1 java class":
- Have a single class UserWithAccount (holding user and account info)
- assertObject( someUserWithAccount )
- write a rule with a single parameter (UserWithAccont)
Are there any guidelines as to where to use each approach ?
How would it affect efficiency ?
In general, I'd appreciate any references to books/tutorials on design and
efficiency for applications using Drools (or any other OOP rule engine, for
that matter).
Thanx very much.
---------------------------------
Bring words and photos together (easily) with
PhotoMail - it's free and works with Yahoo! Mail.