Showing posts with label rules. Show all posts
Showing posts with label rules. Show all posts

21 November 2007

Some Online Articles on Tags+Folders, Rule-based-Systems and Governance

Just minutes ago I struck a deal with SIGS-Datacom, publisher of the (German)
OBJEKTspektrum and JAVAspektrum, so that my recent articles in those magazines are now available as pdf-downlad for free...



  • Ordnung 2.0: Hilfe für den Info-Dschungel: Reality-Check von tags-versus-folders



  • Wohin mit der Logik: Regeln als Rettung. Der Artikel beschreibt, wie Sie Fachlogik mit Hilfe von Regelmaschien aus Ihrem Quellcode auslagern können - mit viel Flexibilität und signifikanten Risiken...



  • SOA Governance ist ein wesentlicher Erfolgsfaktor für SOA. (Mit Arne Koschel). Bei unserem Plädoyer für SOA-Governance gehen wir davon aus, dass für SOA

  • Regelbasierte Systeme (mit JBoss-Drools). Der Artikel stellt JBoss-Drools vor, einen bewährten Open-Source Vertreter Java-basierter Regelmaschinen.



15 November 2007

Business-Rule Technology becomes Acquisition Target...

Australian based RuleBurst just acquired Haley Technologies, one of the thought-leaders in rule-based technologies... (announced here and on the JBoss-Drools Mailing list).

A few days ago, SAP bought Indian-based Yasu (provider of the QuickRules BRMS)...

Just in case you're interested in Rule-Engines - might be the right time to invest in those companies... they surely deserve a lot more corporate attention... problem is, most of them aren't public (yet)!

08 October 2007

Drools-Puzzle #2: And the Winner is...

Scott Reed (.... applause ...)

Dunnit! A dozen solutions to the second installment of the (now famous!) Drools puzzle contest arrived at my desk, originating from brave men spread all over the world (all right, at least from Australia, South-America, North-America and Europe).

I evaluated during a brief holiday in souther Turkey - without internet access and with only Drools 4.0.1 plus Eclipse 3.2 installed on my MacBook. That initially sounded all right for me - but wasn't. Read on why I failed to evaluate a few (gorgeously interesting) solutions with this setup!

C++ for highest performance



Like in puzzle #1, all rule-based solutions were outperformed by Dirk Farin's C++ version. Dirk: You're great. But we're using rules to factor business-logic out of java applications... If we ever need to build something ultra-performant, we'll surely remember your approx-one-nanosecond-solution. Btw: I took your source and could immediately build-and-run it on the Mac :-) Dirk used numbers instead of (symbolic) names, which makes his solution-output a little hard to read...

Although admirable in performance, Dirks' solution still is a C++ program... and I didn't let those count in the puzzle...

Standalone CLIPS


The next hurdle in evaluation came from Johan Lindberg from Sweden: He send a pure CLIPS solution, which wouldn't run in Drools either...

Johan seemed to be pleased with the puzzle and asked for more. Johan & Dirk - please send us Drools solutions next time :-)

Only Seeing is Believing


Like in any athletic competition I required the winning solution to run on my machine - during my evaluation. I didn't actually feel the urge to debug or modify submissions so they would/could run in my limited setup (see above). Although this may sound unfair ("but we're still using 3.x in our project"), I had no other chance.

Therefore, solutions without source-code (Carlos Bustamante), with requirements to "mvn install" additional drools modules (Geoffrey DeSmet) or with Drools 3.1 rule syntax didn't count either. Sorry guys - life can be tough. More on Geoffreys' solution later on...

Now there were 7 solutions from 6 participants left over to compare. It had already gotten hot in
the mediterranean hemisphere - I noticed other people jump into the pool, I smelled roasted garlic and delicious turkish mokka. But I kept evaluating...

Simple and Complex Rules


No participant bothered with any explanation, how or why his solutions works. They all did work correctly, by the way. But with several of them I still don't know why. The golden ideas of their creators, those shiny bits
of knowledge - buried in crusts of unexplained code. I hear people talking about self-explaining code, of the truth that only lies on code, never in documentation. Might hold for guru-readers, but not for humble-ones like myself. I need explanation, abstracted away from source-code. Even for our simple puzzle, several solutions spanned more than 100 lines of code - mostly without any docu.

For me, this is one lessons I (once again!) learned from this puzzle: Care for understandability.

All solutions gave correct results - but I evaluated only one (from John Kirchmeier) as "clean-and-simple", without fancy decoration, and gave it top-score in "Drools code understandability". Well done, John!

One case in particular gave me headaches. One participant (he'll know who I'm talking about), a real Drools-guru, supplied a solution based on the DroolsSolver approach (formerly known as Taseree). In my remote holiday location, without internet access, I couldn't even build it. He was the only one to submit a solution based on a scoring approach - his program creates just one (arbitrary) family, scores it and, if the score is not perfect, modifies the family... The result surely works - but at what price? The "business logic" of our simple riddle gets mixed up in six business rules, one scoring rule and a pretty complex (java) function to re-order the family relationships - naturally based on Generics, a FamilyMoveFactory and two Switcher-classes... Impressive stuff, I'm sure this approach will solve generations of extremely complex riddles - but simply overwhelmed me. Impressiveness doesn't count.

Another sting to another participant: 18 rules for this puzzle might be a little over-modularized...

Running for Gold


Now that I bashed a little on overly complex solution approaches (yep - rules can be kept simple yet correct!), what solutions remained in the race for the title? (Running on a MacBook Pro, Intel Dual-Core, OS-X 10.4.10, 2GB Ram, Eclipse 3.2 with Java 1.5, running exclusively Eclipse and Finder, using System.currentTimeMillis() for timing). I ran every solution 3 times and took the lowest values for the overall performance (that is: initialization plus rule-evaluation!).


  1. Scott Reed, 1596 overall, 37 for Drools

  2. Christiano Guiffrida, 1682 overall, 33ms for Drools

  3. Dan Berindei (first solution based on fact-retraction), 1720ms overall, 110 for Drools

  4. John Kirchmeier, 1760 overall, 53 for Drools

  5. Dan Berindei (second solution, without retract), 1812 overall, 65 for Drools

  6. Chris Barham, 1875ms overall solution time, 56ms for Drools.

  7. Reginaldo Delfino, 1956 overall, 77 for Drools



Scott - congratulations. Your solution outperformed the other Drools solutions. Please supply the next puzzle to the Drools community!

It was close: Christiano's and Dan's solutions were pretty fast too. My personal evaluation
on understandability: The fastest solutions score 4 out of 5 possible points.

With 1760 msec overall runtime, John Kirchmeier's clean-and-elegant solution provided an
excellent compromise between efficiency, maintainability and understandability. John: You're my moral winner, with a rule-understandablity-score of 5.

Download of submissions


I do not provide downloads for the submissions - maybe the participants can put their solutions
in the JBoss-Wiki and send me the link - I'll post those here!



Hints for the Future


As code quality remains to be very subjective, it cannot easily be evaluated by a single referee
in our little contest. Taking pure performance clearly identifies a winner - but as a software-architect
I'd definitely pick the solution with the lowest overall complexity and acceptable performance.

I propose that from now on each "puzzle-creator/judge" publishes her or his set of evaluation
criteria... (I failed in this respect - sorry!). Next time I'd even propose a naming convention plus a predefined "main" class structure:


main(...)
//...
long start = System.currentTimeMillis();
init_rule_file();
long begin_fact = System.currentTimeMillis();
pre_init_working_memory();
wm.fireAllRules()
long end = System.currentTimeMillis();
//...


Thanx again for participating!

31 August 2007

Maaaany bugs fixed in Drools...

The Drools-team just published their maintenance release 4.0.1 with loads of bugfixes (described here).

Thanx for your good support, guys :-)

19 August 2007

Rules-Programming-Contest, Round 2

Round 2 of the JBoss-Drools puzzle contest just started...
(this time it was *me* who had to post the puzzle...)

Deadline for submissions is September 14th, 2007.
You can send your solutions to droolspuzzle@gmail.com

=====================================


  • Three men, Abel, Locker and Snyder are married to Edith, Doris and Luisa, but not necessarily in this order.

  • Each couple has one son.

  • The sons are called Albert, Henry and Victor.

  • Snyder is nor married to Luisa, neither is he Henry's father.

  • Edit is not married to Locker and not Albert's mother.

  • If Alberts father is either Locker or Snyder, then Luisa is Victor's mother.

  • If Luisa is married to Locker, then Doris is not Albert's mother.



Who is married to whom and what are their sons called?

Taken from the German book "Denken als Spiel" by Willy Hochkeppel, 1973 (Thinking as a Game).
=====================================

The Rules of the Contest

More info on the contest.

We're looking forward to your contributions -
let the rules rule...

28 July 2007

Golfer-Riddle (Prolog-Version)

In my ongoing quest for improved awareness for rule-based systems, I solved the golfer-riddle in Prolog and published the solution together with an explanation here.

It's a pretty straightforward translation of the riddle itself - Prolog rocks!
(I'm open to improvisation suggestions...)


gcolor(blue).
gcolor(plaid).
gcolor(orange).
gcolor(red).

gpos(1).
gpos(2).
gpos(3).
gpos(4).

golfer( [_, C, P] ) :- gcolor(C), gpos(P).

golferRiddle( G1, G2, G3, G4) :- golfer(G1),golfer(G2),golfer(G3), golfer( G4),
G1 = [fred, FredCol, FredPos ],
G2 = [joe, JoeCol, 2],
G3 = [tom, TomCol, TomPos],
TomPos =\= 1, TomPos =\= 4,
TomCol \= orange,
G4 = [bob, plaid, BobPos],

/* unique colors */
is_set([FredCol, JoeCol, TomCol, plaid]),

/* unique positions */
is_set([FredPos, TomPos, BobPos, 2]),

/* Fred's right neighbour wears blue */
plus( FredPos, 1, FP1),
member( [_, blue, FP1], [G1, G2, G3, G4]).

18 July 2007

Pragmatic Re-Re-Branding

A good move: The (awesome) rule-engine "Drools" is back- including a new version of its logo:

jboss-drools-logo

Mark Proctor writes in his blog:

"Having received community feedback 4.0 will start the push to reclaiming the Drools name.... So to help speed up this process, I would please encourage everyone now to use "JBoss Drools" in any articles, blogs, talks etc."


I'll start: JBoss-Rules will be called "JBoss-Drools" from now on (again)...

13 July 2007

Why JSR 94 is a futile attempt to solve a no-problem

Q: What's a no-problem?

A: A problem which never occurs in practice but is defined to be one by some committee.

---
Q: What's JSR 94?

A: An initiative to define a Java runtime API for rule engines by providing a simple API to access a rule engine from Java. In theory, rule engines can be seamlessly interchanged if they comply to JSR 94.

---
Q: Why is JSR 94 solving a no-problem?

A: IMHO there at least two reasons:
1. JSR 94 covers only the rule engine API, but NOT the rule language (which might, one day, be covered by RuleML).
+ This API describes how a rule engine should be invoked from Java. That's (simple) infrastructure code - you need a couple of classes and interfaces for it.
+ If you change your rule-engine, just rewrite those few classes and you're set... at least with the infrastructure.
+ You'd have to rewrite (and re-test) ALL your business rules to change the engine - and rule languages are by no means similar to each other...
2. Who wants to change the database? In more than 20 years I have not seen a single customer migrating a productive system from one database to another - although database independency long seemed a crucial issue.
+ I've experienced cases where we used MySQL for development and Oracle for production - but they behaved differently, even with powerful OR-Mappers we could not resolve those issues.
+ Don't tell me anybody wants to try this with their business rules... nobody wants them in two different rule-languages.

---
Q: What do the rule-engine vendors say about it?

A: I don't care. SQL-vendors blubbered about interoperability for ages. But they always found ways around it.

---
Q: What shall I do if I care about rule engines?

A: Choose the best one for your purpose. And be prepared to stick to it for a long time.

02 July 2007

My walkthrough of a JBoss-Rules Example...

I originally planned to blog on this later this year, but as Mark Proctor of JBoss
has already published it
...

"Dr. Gernot Starke has created a walk through of the Golfing example which can be found here: http://rbs.gernotstarke.de/samples/samples/golfer-riddle-jbr.html.

It's great that someone has taken up the role of documenting our examples, this is something we've purposefully held back on doing, hoping the community would take up this role - Thank you Dr Starke."



my pleasure, Mark!

23 May 2007

Interested in Rule-Engines (and their performance)?

an interesting writeup on rule-engine performance, comparison between
MS-Biztalk-Rule-Engine, Drools and Jess.... plus a rather lengthy (and friendly!) comment thread.

One summary: one should really care about rules and their management (most engines don't provide much support here!), less about details of rule algorithms... Your business simply doesn't care about RETE or not, unless their rules are interpreted correctly.

Would be nice if more commercial rule-engine providers would publish comparable benchmarks... maybe one of you readers could wake them up!