I feel using Drools would increase the
development time a lot.Also from a maintenance
perspective it might consume lots of effort.
Can anyone advice me what to use? also please let
me know the PRO's and Cons if any?
I think your main concern is mentioned in the last lines not the 80% above it :o)
You need to evaluate the parametes of why you would want a rules engine. I think
there is plenty of advice in the documentation also.
But personally here are the challanges I faced:
For a production quality system. There is more to oconsider than just that part
of it. (the ones you mentioned above)
1. One of the problems I faced was that DROOLS is an API and apart from the BRMS
part there isnt any production quality Service available. Like an EJB or RMI.
which would also require you to create your rule loading and refreshing
mechanism (They are working on it, but I had to build it from scratch)
2. How would you like to represent your rules? Is the intention that even a
non-technical user can play with them, or you dont care about rule authoring?
A rule engine, really comes to fore here. You have to script your rules with
business objects.
It's great fun but if you are short for time it can make your
sweat.
It's cool stuff but in production its not about cool, but $$$ and time
They have 3 major ways of representation: DRL, DSL, Decision Tables and Rule
Flow. Writing rules, does have a learning curve and each type of methodology
also has its own curve.
I love the fact you can take an Excel sheet and write rules on them, this is a
BIG Hit with non-technical users,
all thought they still get confused, when the
combinations on a table increase ...lol
3. You have to bring the QA on board on how to test it. It requires a different
mind set. In the documnetation you will learn about FITS but your QA should be
reading that also.
I had (have) a problem there.
4. With jBoss rules 4 what I really appreciate is "From".
Everything else is magic in the java world but in real life production,
you more interested in how you talk to external data sources; DB, LDAP,
CRM systems etc.
So you have to think of what ratio of your data do you pre-initialize before
sending to the engine and what part should be queries within the engine.
Another tip: I found in "From" (used for getting data from extrnal source)
5. What is the expected shelf life of the product? if its long and Business
Logic is a very complex piece that they would like tighter control of then a
rule engine is a good investment;
if your a programmer looking for a quick solution or alternative
its worth experimenting.
6. the use of a rule engine (specially this one), stream lines the use of
business logic. In a normal application, it depends on the programmer. but here
(well yeah a lot depends on your rules and objects), but its better organized
to suit long run needs.
7. Experience: No one in your company really cares about whats going on in an
engine compared to the bigger pciture. So someone in your organization need to
know the engine itself, its not good enough being a black box.
You'll be shaking when things go wrong in production if you dont have tight
command over concepts :O)
8. Performance: In the rule engine world people will talk about Rete, Rete 2
etc. Well when you dig deep a lot depends on:
8.1. Amount of external Data
8.2. Single based querying or batch
8.3. The way rules are written
With RETE, the number of rules has a NEGATIVE EXPONENTIAL time per rule. So if
you were to compare a flat Java Logic program and Rules Engine with loads of
rules and logic, the engine should beat it. But why I find this funny, is coz
this is not real life. In real life, its all about your interaction with
external data. When you write a program on an engine and one that talks to a
database, reality hits you in the face.
You go to you client with a report on an empty in-memory engine running rules;
he's not going to be very interested to be honest.
It the end to end picture that counts.
Rules ar always written in mind, as if you are operating on one entitiy or
maximum a "collection" but in an ER rlation usually to one entity still.
So BULK querying in the middle ofthe engine is not possible;
you must BULK query during pre-initialization of your objects.
8.3. Fortunately JBosss Rules 4, gives you the ability to do Asynchronous
executions. With a lettle effort you can improve performance by bulk querying.
It has nothing to do with the engine.
where performance is hit, is the extrnal data source. If all your performance
needs are taken care by the database and you have no need to consider the above
points then maybe a database is good. BTW Oracle has an inbuilt RETE based rule
engine, tehre has to be a reason why they put that there :o)
I personally love it, but I have had to face challenges in trying to develop
some understanding on this.
The best thing about Drools is, the team is really fast to response and really
helpful and I think their support reallllly rocks! so you are in safe hands if
you plan to roll up your sleeves :o) Their core API is getting rock solid and
it better be; because my life depends on it in a month ..haha!
But you must have an investment period on it before diving in.
If you have that, it's worth it.
I hope this advice is an unbiased view of things.