Chapter 6
Processing Data
Compares the various techniques for rule-based and procedural processing, and describes how to use rules for event detection and data-driven processing, methods for describing object behaviors, procedures for generic sequential processing, and APIs for programmatic access and control.
- Introduction
- Terminology
- Determining Which Type of Processing to Use
- Choosing Between Rules and Procedures
- Similarities Between Rules and Procedures
- Differences Between Rules and Procedures
- Syntactic Differences Between Rules and Procedures
- Emphasizing Procedural Processing
- Using Rule-Based Processing
- Using "Whenever" Rules to Detect Events
- The Five Types of "Whenever" Rule Events
- Example of Event Detection
- Using "If" Rules for Data-Driven Processing
- Example of Data-Driven Processing
- Summary of Forward Chaining Options for Parameters and Variables
- Summary of When Attributes, Parameters, and Variables Forward Chain
- Using Backward Chaining
- Detecting When the Value of a Variable Changes
- When Different Types of Rules Initiate New Processes
- Guidelines for Implementing Rule-Based Processing
- Emphasize "Whenever" Rules Over "If" Rules
- Encapsulate the Consequent of a "Whenever" Rule
- Avoid Scanning Rules
- Write Rules that are as Generic as Possible
- Do Not Use "Initially" Rules
- Use "Unconditionally" Rules with Caution
- Minimize Backward Chaining
- Narrow the Scope of Rules to Minimize Rule Invocations
- Disable Rule Highlighting
- Using Procedural Processing
- Choosing Between Methods and Procedures
- Using Methods to Describe Object Behaviors
- Creating a Method
- Creating a Method Hierarchy
- Documenting the Calling Protocol for a Method
- Using Procedures for Generic Sequential Processing
- Creating Test Procedures
- Creating Callback Procedures
- Creating Non-Extensible Procedures that Operate on Values
- Creating API Procedures
- Initiating Procedural Processing
- Implementing Single-Threaded Procedural Processing
- Maintaining Atomicity
- Implementing Multi-Threaded Procedural Processing and Wait States
- Wait States
- Procedural Statements that Implement Multi-Threaded Processing and/or Introduce Wait States
- Examples of When to Use Multi-Threaded Processing and Wait States
- Guidelines for Implementing Procedural Processing
- Keep Procedures to a Manageable Length
- Eliminate Redundant Code
- Use Specific Type Declarations
- Avoid Polling
- Do Not Redefine the Role of Local Variables
- Clean Up Unused Local Variable Declarations
- Signal Errors, Do Not Return Status Flags
- Use Methods to Implement Optional Procedure Arguments
- Maintain Atomicity Whenever Possible
- Consider Performance
- Write Code So Few Comments are Necessary
- Constructing an API
- Determining the Scope of the API
- Validating Arguments and Signalling Errors
- Guidelines for Creating an API
- Include the Client as an Argument
- Maintain Atomicity in API Procedures
- Shadow Public Procedures with Private Procedures
- Limit the Use of On Error Statements
Copyright © 1997 Gensym Corporation, Inc.