Rule Based Declarative Programming Demonstration
This is a demonstration of one way a program can be customized without having to write custom code. This demonstration uses a rule base to execute code based on logic created by the user. Each rule is made of filters that determine when the rule is true. Each rule has an associated action, which the user selects. The user builds the logic to create the rules. The user determines which rules will make up the rule base. In this way, how a program behaves can be determined in a declarative manner.

In this case, I am using vehicle attributes to make up the knowledge base. To use this demonstration, start by creating filters. Once filters have been created, rules can be created using these filters. When the rule is created it is given an associated action and a subject variable with a goal or target value. Rules are then grouped together to create a rule base. Lastly, the demo can be run. The user can create a sample data set by selecting variables and assigning them a value. In a real system, this data would come from the system being run. The bottom of the last screen shows the final outcome.

Creating filters:
Simple filters are created by selecting a variable, a condition and setting a value. By clicking the more button you can create filters with multiple parts. The match all or match any determines and/or. Once simple filters are created, compound filters can be constructed. The lower part of the window creates compound filters in a similar manner as the upper section. Choose match all or match any for and/or. Select a filter to add. Click more to add filters to the compound filter.

Creating rules:
Give the rule a name, pick the subject of the rule and set its target value. Select an action that should be performed, when the rule is true. I have created two simple actions. One changes the subject variable to the target value and one and that displays a message before setting the value. Lastly, pick the filters that will make up the rule.

Creating a rule base:
Give the rule base a name. Select the rules that will make up the rule base.

Running the demo:
Setting the variables to the values you want. Click OK and the program will test the variables and if rules are true the associated action will be performed. The end result is displayed in the lower part of the window

Here is a sample of what you might try.

Filters:
vehicle type = automobile
engine = yes
wheels = 4
(number of doors = 3 and size = medium)
(number of doors = 5 and size = large)

Compound Filter:
((number of doors = 3 and size = medium) or (number of doors = 5 and size = large))

Rules:
name automobile
subject vehicle type
target value automobile
filters:
engine = yes
wheels = 4
name MiniVan
subject vehicle
target value Mini Van
filters:
vehicle type = automobile
((number of doors = 3 and size = medium) or (number of doors = 5 and size = large))

Rule Base:
name vehicle
rules:
automobile
MiniVan

Demonstration:
variables:
engine yes
wheels 4
size medium
number of doors 3

Outcome:

The program should determine that two empty variables, vehicle type and vehicle should be set to automobile and Mini Van