Martin Fowler dislikes rules engines. I’m not so sure

There’s no doubt that a generic rules engine can sometimes be a solution in search of a problem. The work to implement and manage both the rules and their interfaces with external systems can often completely dwarf any work which might be needed to implement the same behaviour in a regular programming language.

Martin Fowler has recently written about this problem in his “bliki”, and comes down in favour of always putting the effort in to work on a programming language solution alongside any exploration of a rules engine approach.

MF Bliki: RulesEngine

However, rather than seeing this as a reason to distrust the idea of rules engines as a whole, I prefer to see this is a problem with the implementation of traditional rules-engine technology. There is an argument, for example, that current fan favourite language Erlang is largely a rules engine.

The history or rules engine development is long, and many of the common conventions have a largely historical basis. The choice to represent rules in a text file represented as some lisp-based format (or a slightly more modern equivalent using XML), for example, is not really key to the concept of a rules engine. Likewise the heavyweight and single-threaded way that many rules engines operate is also mainly a historical implementation choice.

A light weight and efficient rules engine, well-integrated with the host language or environment is entirely possible, but despite several searches around the software universe I have found very few candidates, and none of the usual suspects, which work this way.

Maybe I ought to dust off my own implementation again 😉

3 Comments

  1. My take on Fowler’s bliki is not that he is against a rules engine but that there are some inherent liabilities, and that when using a rules engine that you have to be mindful of those liabilities.

    I also postulate that the same liabilities and benefits engendered from using a rules engine are also similar to using an event driven design.

    My post on this is:

    http://uglylispcode.wordpress.com/2009/01/09/rules-engine-or-event-collaboration/#more-184

    Nothing published yet, but I’m researching RETE algorithm and it has connected me to inference engines and complex event processing.

    There is a lot of meat in just this one subject.

    IMHO this directly relates to “machine control”, which if you look into Peter Norvig you will find it fits up into his alley with GOOGLE.
    Just starting a search on wikipedia

  2. I see what you mean. It’s entirely possible that I am reading into his words what is not really there.

    However, I still feel that there is a distinction between traditional rules engines (which are mostly what you will encounter as you pursue investigation into RETE) and a lighter-weight, more modern, multi-threaded approach.

    When I went through a similar research process a few years ago it took me quite along time to cut through the mystique of RETE to find much concrete detail. What I found was nothing very special. A technique for caching and sharing partial evaluations. Something modern distributed systems do all the time.

Comments are closed.