2008.08.07 - Novice Rules Walk Through

If you are coming on remotely at the time of the meeting, here is the gotomeeting

Please join my meeting at
 https://www2.gotomeeting.com/join/706308660

You will need skype to follow the audio, my skypeid for getting in is petecarapetyan


 

We canvassed our membership (email list) and got a bunch of responses, most of which seemed to be related to getting started.
 So this meeting will have these three purposes

  • Show everyone how to get started with rules, completely from scratch. ( hint: Start here )
  • Do a live hands-on of worst case type of nested if statements that make rules the logical approach
  • Build it in rules, and Put it on line as we go, so future users have a fighting chance at following our bread crumbs.

This will be a hands on, so please bring your laptops loaded with Eclipse and the drools 4.0.7 eclipse plugin, if at all possible. If not, there will be plenty who do, so you'll be able to sit next to someone if you don't.

The business rules - early formation of questions:

We made up a mock set of facts about rules themselves. We needed some facts that get complex, so why not facts about facts ? That gets pretty complex.

To create for ourselves a ridiculously challenging usage of nested if's we will utilize the following mock logic hierarchy, er uh, these business decision facts:

  • Has our corporation's management been made to understand rules yet ?
  • Are we using a java environment that we can program drools or another free tool to demo the value ?
  • Are our rules sufficiently nested and confusing to make the externalization of rules worth the effort ?
  • Who is managing the externalized rules and will there be future changes in this logic ?
  • Do we have enough time to learn the process and get it going ?
  • Can we run the demo and show this value to the our corporation ?
  • Do they have the management intelligence to see the value and realize what they could gain ?
  • Is the hosted application sufficiently important to merit the expense ?
  • Is my the project manager a (jerk, great guy, pansy)
  • Does the project manager (like rules, hate rules, send me to DRG, resist anything ever suggested, hate new things)
  • Does my manager like me ?
  • Did I tell management about rules or demo it ?

The Object Structure

Obviously we need to have some kind of object structure that allows for representation of the above questions.

Once we have these objects, we can begin writing this in pure java without consideration of any externalized rules.

That should make things plenty nasty enough to make rules worth considering, and then we can do the rules.

The UML

uml

The Rules In If/Then Statements

if(ourRules.tooNested){

{

rules.increasePerceptionOfValue(20)

}

if(management.understandsRules){

rules.increasePerceptionOfValue(100)

}

etc etc etc

Setting Up Rules

Now that we have it all in java, we will need to set up the rules engine. We do it all in class, using the helloWorld sample that optionally installs with drools projects.

First we'll just get it all compiling and running. Then, one by one we can begin engaging the syntax of the rules file and running it to see how it all works.

This section is the scariest section for many of us, so we'll do that really slow and easy to make sure everyone follows along.

Syntactical Confidence

One thing I discovered when I did this the first time is how fast it is to go through trial and error and get my rules to run better and faster. The rules DSL is easy enough to pick up quickly, we'll even do it in our little class here.

A Running Example

I've got a start at the code, as well as all of the setup stuff documented below. So you can wait until the meeting by CD or get it now from

http://dallasrulesgroup.org/2008.06.05_Downloads_and_Setup

or, for just the code itself, here is the subversion site

http://svn.dallasrulesgroup.org/code4meetings/   - the project to check out starts with "shallWe~"

Practice Screencast - Preview

To prepare for the first part of the session I made up a screencast to practice against - you can watch it here:

http://appwriter.com/drg080605one/drg080605one.html