Detailed Design
Michael Wales - NeedMoreHP@yahoo.com
EEL 5874 - Expert Systems and Knowledge Engineering
Version History:
Document | Date | Description |
Detailed Design V1.0 | March 20, 2002 | Initial Document |
Detailed Design V2.0 | April 17, 2002 | Knowledge Diagram updated to reflect final design |
Table of Contents
The system consists of two separate applications that talk to one another over a TCP/IP socket. Both applications are console based Java applications, but the ComputerAdvice application could possibly be changed to a web-based Java applet or a Java Swing based GUI. JESS is purely text based and is only meant to run in the background.
ComputerAdvice:
Computer advice is the application that should be started first. The first thing it does, is open a server socket connection for JESS to connect to. When it finally gets a connection from JESS, it sets up the input and output streams to JESS, and goes into a loop that consists of the following:
A large portion of ComputerAdvice is the HardwareCosts class. This class is responsible for developing a list of hardware for JESS to purchase, taking purchase requests from JESS, and keeping track of what JESS has ordered already. This application in the final design will probably gather the hardware cost information from a flat file. This class could be created to gather the information from a database, but that isn't necessary.
JESS:
JESS runs a script file (computer.clp) that establishes all the rules for the application, and asserts the startup fact. The script also tells JESS to open a socket (a built in feature for JESS) to ComputerAdvice. As the rules fire, they will send messages back and forth between JESS and ComputerAdvice. Here is the basic order of how the script is processed:
Network protocol for the system
JESS controls the network. ComputerAdvice simply does what JESS tells it to do. Here is a list of the commands sent to ComputerAdvice. When ComputerAdvice starts, it waits and listens for JESS to connect to it on port number 8034.
Command Name | Description |
JESS-FINISHED | This tells ComputerAdvice that JESS has finished execution and will no longer be sending anything else to ComputerAdvice. When ComputerAdvice gets this message, it closes the socket connection and exits back to the DOS prompt. |
JESS-HWCDB | This tells ComputerAdvice that JESS wants to purchase a new piece of hardware. The command also passes parameters. Here is the format of the entire message: JESS-HWCDB:Item:Money The Item is the one word description of the item to be purchased. The money is the amount of money the user has left over for the system. ComputerAdvice upgrades the user to the next piece of hardware (if they can afford it), and deducts the amount of the item, and then sends the new amount of money they have left back to JESS over the socket. |
JESS-PRINT_SYSTEM_INFO | This tells ComputerAdvice to print out the list of the hardware purchased by JESS, and what the total amount of system will come to. ComputerAdvice keeps track of what JESS has purchased so far, so ComputerAdvice can print out the entire list with nothing more required of JESS. |
JESS-PROMPT_USER | This tells ComputerAdvice to ask the user a question, and to send back what the user inputted. |
Difference between production version and prototype
The initial prototype turned out very well for this project. It took many revisions to get a working prototype, so the final version worked pretty well. So I will not need to perform a paradigm shift or throw away the initial prototype. The initial prototype will be simple expanded on to include more computer system uses.
The HardwareCosts class in ComputerAdvice will be modified to read the information out of a flat text file. Right now it simply has a dumb algorithm for the hardware costs, but in the final version it will be a more real world portrayal of hardware costs.
For the final production system, the knowledge will be documented in the computer.clp file, and in an HTML document as tables.