YOUR FEEDBACK
More on the Software Assembly Question - Do Design Patterns Help?
Yanic wrote: Hi, > UML and MDA are being changed to be more data and doc...
SOA World Conference
Virtualization Conference
$50 Savings Expire May 23, 2008... – Register Today!


2007 West
GOLD SPONSORS:
Active Endpoints
Your SOA Needs BPEL for Orchestration
BEA
Virtualized SOA: Adaptive Infrastructure for Demanding Applications
Nexaweb
Overcoming Bandwidth Challenges with Nexaweb
TIBCO
What is Service Virtualization?
SILVER SPONSORS:
WSO2
Using Web Services Technologies and FOSS Solutions
Click For 2007 East
Event Webcasts

2008 East
PLATINUM SPONSORS:
Appcelerator
Think Fast: Accelerate AJAX Development with Appcelerator
GOLD SPONSORS:
DreamFace Interactive
The Ultimate Framework for Creating Personalized Web 2.0 Mashups
ICEsoft
AJAX and Social Computing for the Enterprise
Kaazing
Enterprise Comet: Real–Time, Real–Time, or Real–Time Web 2.0?
Nexaweb
Now Playing: Desktop Apps in the Browser!
Sun
jMaki as an AJAX Mashup Framework
POWER PANELS:
The Business Value
of RIAs
What Lies Beyond AJAX?
KEYNOTES:
Douglas Crockford
Can We Fix the Web?
Anthony Franco
2008: The Year of the RIA
Click For 2007 Event Webcasts
SYS-CON.TV
TOP COLDFUSION LINKS


Playing With(in) the Rules
The Rule Manager Façade

Digg This!

Page 1 of 4   next page »

In a book entitled Finite and Infinite Games in 1986, James P. Carse wrote "Finite players play within the rules, infinite players play with the rules." We play finite games every day, from checkers and chess to Yatzee and Monopoly. Finite games have a familiar pattern: a beginning, a middle, and an end; a winner and a loser.

A finite game is easy to play because it has a limited set of fixed parameters. Carse also wrote "Finite players play to win, infinite players play to keep playing." Custom software development is not a finite game, and the clients who purchase it are not finite players. The objective of a workflow application is not to win an office betting pool, or even to design and complete a superior workflow application. The objective of a workflow application is to continue to distribute an ever-changing flow of work. Yet as custom software developers we tend to play the infinite game with finite rules.

We shouldn't be taking a request from a client to change the way our application determines how work is distributed (15-day expiration instead of 30-day expiration, apply special notices to tasks above or below a particular dollar value which is later changed, etc). Instead we should be providing our clients with the tools to change these business rules themselves, so that instead of constantly trying to keep up with the stream of client change requests that result from hard-coded business logic, we can move on to the next feature or application, and play the infinite game on their terms, playing with the rules rather than playing within them.

A Brief Example
A typical business rule should be familiar to all of us and is usually described to us by a client with words like this: "commissions for this project are due to the sales person 15 days after receipt of at least 10 percent of the deposit." This rule has one objective (indicating current payments due to the sales staff) and several parameters, including the required deposit amount, an arbitrary figure (10%), the date on which the figure is satisfied, an arbitrary duration (15 days), and by implication, the current date. These are typical logical equations and we know intuitively how to write software to perform these comparisons. The code usually looks something like this:

<cfif sale.getDepositPaidByDate(dateAdd("d",-15,now()))
  gte (0.1 * sale.getFullDepositAmount())>

As long as the application you're writing will be sold only to one client, and that client never changes their rules, this line of code will survive the lifespan of our application. The problem with this is that, while it may satisfy the client it doesn't help us much. It doesn't allow us to sell the same application to another client without reinventing this portion of the code and so at the end of the day it amounts to being paid an hourly wage for your work instead of building equity in your software.

The Challenge
There are two barriers to transforming this finite equation into a flexible rule that many of your clients can modify without your aid or intervention:

  1. Storage: Because the arbitrary rule criteria must become data that can be dynamically interpreted, the application will need a place to store rules of many disparate types with indeterminate numbers and types of parameters.
  2. Interpretation: Once the storage of the rule data is accommodated, the application needs a system of managing and interpreting a vast array of indeterminate and ever-changing criteria to be applied to an indeterminate, ever expanding set of contexts.
You might notice in the wording of these barriers that I've used a lot of words like "indeterminate" and "expanding" and "changing." In order for your rule-management engine to provide maximum equity it needs to be designed with a minimum of assumptions about your clients' business model. Q. How many types of rules will there be? A. Unknown. Q. How many criteria will an individual rule have? A. Unknown. Q. In what type and how many contexts will the rules be applied? A. Unknown. Because there are so many unknowns it is necessary to use the most encapsulated and extensible tools available to store and to interpret the rules. To meet this challenge I choose Extensible Markup Language (XML) and ColdFusion Components (CFCs).

A single "RuleManager" CFC manages all interactions with the rule data in this application. In Object Oriented (OO) lingo this is known as a Façade pattern, in which a larger library of code is simplified by a single unified interface. Although the RuleManager will require a minimal set of assumptions, certain assumptions must be made in its design to ensure portability:

  • Rules are stored in XML packets; each packet may contain zero or more individual rules:
    1. Each rule may contain zero or more individual criteria (nodes) of different types (date, numeric, money, text, etc.)
    2. A separate CFC must be written for each type of criteria that the RuleManager will interpret (date, numeric, text, etc.) - these criteria-type CFCs must share a common set of methods (interface)
    3. All parameters used by criteria-type CFCs in the evaluation of a rule must be provided in the criteria XML node or by an external context (CFC)
  • When tested for applicability each rule must evaluate to a Boolean value (true/false)

  • The criteria for a rule are cumulative, requiring the satisfaction of all criteria to apply the rule (logical and)

  • A mechanism must be provided for the user to establish sub-sets of criteria that are not cumulative (logical or)

  • Page 1 of 4   next page »

    About Isaac Dealey
    Isaac Dealey has worked with ColdFusion since 1997 (version 3) for clients from small businesses to large enterprises, including MCI and AT&T Wireless. He evangelizes ColdFusion as a volunteer member of Team Macromedia, is working toward becoming a technical instructor, and is available for speaking engagements.

    CFDJ LATEST STORIES . . .
    AJAX World – Personal Branding Checklist
    This is a checklist of items you need for an all-encompassing personal branding strategy. Personal branding is the process of marketing and selling yourself as a brand in order to gain success in business. Personal branding is a continual process just as knowing yourself is a continual
    3rd International Virtualization Conference & Expo: Themes & Topics
    From Application Virtualization to Xen, a round-up of the virtualization themes & topics being discussed in NYC June 23-24, 2008 by the world-class speaker faculty at the 3rd International Virtualization Conference & Expo being held by SYS-CON Events in The Roosevelt Hotel, in midtown
    What Is ColdFusion in the Age of Java?
    As CFML developers start to learn Java and move into the realm of Spring and Hibernate, it is very important to stop and ask 'What Is ColdFusion?'. ColdFusion, since CFMX, has been a J2EE application running within a J2EE server (JRun, JBoss, Tomcat, Websphere, etc.). This is important
    Opinion: Give ColdFusion Some Room to Breathe
    My personal approach has become to to let ColdFusion do what it does best, and no more. No AJAX generation or any of that silly UI stuff. Leave that to the AJAX frameworks, or Flex, or whatever your UI is going to be on the front-end. That's what the UI tool was designed for, CF wasn't
    Viewpoint: Not Every ColdFusion Developer Should Be A Flex Developer
    I am going to go ahead and contend that although a good number of ColdFusion developers can grasp and understand Flex very well, there are also a good number of ColdFusion developers who have no business going anywhere near Flex. Why do I say this? I am a big fan of Flex. I use it dail
    JavaOne 2008: Sun Talks Up its Late-to-the-Party AIR-Silverlight Rival
    At Java One this week Sun has been selling its year -old-but-still-upcoming - and definitely late-to-the-party - Adobe AIR- and Microsoft Silverlight-competitive JavaFX Rich Client environment as a potential revenue-generator capable of putting ads on mobile applications and JavaFX Scri
    SUBSCRIBE TO THE WORLD'S MOST POWERFUL NEWSLETTERS
    SUBSCRIBE TO OUR RSS FEEDS & GET YOUR SYS-CON NEWS LIVE!
    Click to Add our RSS Feeds to the Service of Your Choice:
    Google Reader or Homepage Add to My Yahoo! Subscribe with Bloglines Subscribe in NewsGator Online
    myFeedster Add to My AOL Subscribe in Rojo Add 'Hugg' to Newsburst from CNET News.com Kinja Digest View Additional SYS-CON Feeds
    Publish Your Article! Please send it to editorial(at)sys-con.com!

    Advertise on this site! Contact advertising(at)sys-con.com! 201 802-3021

    SYS-CON FEATURED WHITEPAPERS

    ADS BY GOOGLE