• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Tim Cooke
Sheriffs:
  • Rob Spoor
  • Liutauras Vilda
  • paul wheaton
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Mikalai Zaikin
  • Carey Brown
  • Piet Souris
Bartenders:
  • Stephan van Hulst

One alternative to Rules Engine when time is big money: Gurus please comment

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have 2 approaches to solve the following general problem.

The problem in General: "Extracting hardcoded business rules out of the application and take them out, add/delete/update the rules thus change the behaviour of the application. Give business the capability of adding/deleting/updating (all or a subset of )rules and throw the ball in the business's court."

The problem in Specific: "To evaluate business rules."

I have 2 approaches for this:

1) Use a full fleged Rules Engine even though we might be using 10% of its capabilities but I could take comfort in knowing that with these engine I will be able to many cool things.

2) Use your Database's SQL query evaluation capability and construct conditions and build a query like
(DB2)select 'true' from sysibm.sysdummy1 where ${compound-condition}
(Oracle)select 'true' from dual where ${compound-condition}. Offcourse, while building the conditions we will substitute the actual values for variables.
So two conditions
a. (productType = 'a')
b. (discount < 45.0 )
could be compounded like ((productType = 'a') AND (discount < 45.0 )) as a single condition and when reallife values it would look like
(('a' = 'a') AND (34.0 < 45.0)). If the SQL fetches a row means condition was evaluated to 'true' otherwise 'false'


Any take on the second approach ?
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Neither approach really solves the problem, unless I'm missing something.

With approach 1, you'd still have to create DB queries from the rules somehow, wouldn't you (unless the rules engine you have in mind does way more than I give rules engines credit for).

And I don't see how approach 2 solves the problem of dynamically changing rules. It simply avoids hardcoding them, which is good practice anyway. You still have to implement a way of managing them.

If time really is big money, and you don't have the required expertise in-house, I'd advise to run, not walk, to the nearest consultancy that knows this stuff. A rules engine by itself would not seem to be the best (or only) answer.
 
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yogdesh --

Welcome to JavaRanch!

First: please don't cross-post the same question to multiple forums. It's a potential waste of time for someone who answers a question in one place that's already been answered elsewhere. I deleted the other copy of this post.

Ulf: many rule engines (Jess included) can indeed generate those queries for you, transparently.

There are a number of considerations, obviously. One you didn't mention is the expressiveness of the language. SQL is fairly ugly and it can be hard to express complex tests. Rules engines, on the other hand, generally offer superior languages in which you can write your rules -- some are very Java-like, others are XML, etc. You can pick one in which your developers can be productive.

Using a rule engine -- at least, some rule engines -- makes it easier to write rules that take positive action, as opposed to just modifying data. For example, rule-engine rules can easily send mail or call methods on your business objects, as opposed to operating on the raw data those BOs are persisted to.

But the truth is that rule engines and relational databases are both fruits of the same early research on production systems, and so they are similar in many ways. It's fair to say, I think, that rule engines place action first, and data second, while databases have it the other way around. If you're mostly pushing "dumb data", a database may well be a better fit. If your business objects have complex behaviors themselves, then a rule engine lets you leverage those behaviors rather than replicating them in the database.
 
Yogesh Gadge
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ernest Friedman-Hill,

(First of all I thank you for replying. I have seen some discussions that were related to Rules Engine and the replies were good to learn from so I am kind of pleased that you have replied. ALso sorry I posted it twice in another thread.)

What I understand from what you replied w.r.t SQL vs Rules Engine is :

1) Rules engine is more expressive than SQL queries could become ugly when performing complex conditions which rules engine can generally handle quite gracefully.

2) "If your business objects have complex behaviors themselves, then a rule engine lets you leverage those behaviors rather than replicating them in the database." because rules engine take positive action based on rules evaluation.

Is the data a "dumb data" ?

Let m give some perspective.
To give real life to this discussion I will go into some specifics of my project. We have an application that lets business enter lot of data in the database which is used ibn another application. The UI of the application is Web based and it is so bad that the application is not being used and they give this data to a developer who enters it directly into database and just follows certain rules that are in his mind which is very error prone. The application code is also bad to just improve the existing UI and get the business going because some of these business rules constraints lie in the database as a database constraints foreign key relationship, some rules are hard coded in if-then form in the code and some undocumented rules are their in the minds of business users. The data that they enter, I think, can be called as "dumb data" while it has been entered into database, before we dermine that it is a good dat and can be commited to the database, if we extract all these rules and keep in a repository and apply these rules to

1) determine its completeness - something like if the parent needs to have atleast one children
2) validate some fields e.g. discount field cannot be more than 30%.
3) establish/suggest a path/sequence of how to enter the data because the data foreign-key relationship most of the time.


Also I find it quite interesting that the Rules Engine is so much tied to Actions rather than just applying set of rules to the context and determining if the rules are met.
 
Ernest Friedman-Hill
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, it does sound like you could go either way. I'm obviously biased, and so you need to take that into consideration: but I think a rule engine would give you better application structure.
 
(instanceof Sidekick)
Posts: 8791
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Give business the capability of adding/deleting/updating (all or a subset of) rules and throw the ball in the business's court.



Does anybody have success stories with this?
 
Ernest Friedman-Hill
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
For a subset of the rules, with constrained choices? Yes, absolutely. You can't give business free reign, though. Programs have to be written by programmers, no matter if they're called "code" or "rules".
 
author
Posts: 608
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
First, some history. In the late 80s end user computing was fairly popular, the idea being that the end users could in fact do their own development. Products such as DBASE and Lotus 123 reflected this sort of concept, and reporting packages such as FOCUS were very popular too. In fact, one of the marketing pitches for COBOL in the 60s and 70s was that business people could do their own programming.

In the early 90s user-centered design became popular within portions of the community, the idea being that stakeholders could be actively involved in the development process. Many techniques were explored, but it basically boiled down to using simple tools and techniques which were inclusive.

In Agile Modeling, first published publicly in the Autumn of 2000, we included the practice of Active Stakeholder Participation which expanded on the user-centered design concept. So, it does make sense to me that stakeholders can be involved with development.

As far as programming goes, why not? My sister is an accountant, and she writes data extract code in VB as well as fairly complex spreadsheets in Excel. This is often mission-critical software for a large, well known organization. He skills are mostly self taught, like many people in IT.

Is this ideal? No. In the ideal world she would partner with an IT person that has the skills to help mentor her in developing these things, who would help design it (most of her designs, from what I can tell, are the same thing -- grab the data, cleanse it where needed, then dump into Excel), and help test it. Better yet, the IT person would also be on the ball enough to identify stuff that she's developed that would be needed by others, would clean it up, and then make it available to whoever needs it.

So, my advice is that you should try to find ways to work closely with your business stakeholders. You should have them actively involved with the modeling effort, often all you need to do is adopt inclusive modeling techniques, and you should try to mentor "power users" in more complicated development skills such as programming. It is possible, and in fact I bet if you were to go around and talk with some of your users you would discover that they in fact do develop programs on their own, usually in the form of spreadsheets or MS Access programs. Smart IT people try to streamline this sort of stuff, dumb IT people try to stop it (and they usually fail doing so).

As an aside, I got my writing career started by selling a collection of 5 articles on this very topic to Computing Canada in the Spring of 1992.

- Scott
 
You are HERE! The other map is obviously wrong. Better confirm with this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic