Kevin Reilly

Review of:
E. Friedman-Hill
"JESS in Action: Rule-Based Systems in Java"
Greenwich, CT: Manning Pub. Co., 2002

Computing Reviews, July 2004, Rev. 0407-0777.



This book introduces the expert system shell, Jess, emphasizing Jess-Java integration, perhaps the shell's most interesting and powerful feature. Prior exposure to Java, JavaBeans, and/or Enterprise JavaBeans is deemed helpful. The Jess system and example code are available to book purchasers and teachers with no charge (under conditions restricting use).

Jess nuts-and-bolts are covered first (over 100 pages). In isolation, these snippits' purposes (and associated "limitations" and "restrictions") sometimes appear obscure. Fortunately, much is clarified when many of them are seen again (in later examples). This fragment-centered discourse can perhaps be defended in its providing core details for a non-trivial system with approximately 200 functions --- and yet one still requiring programmer additions! Coverage overall is orderly/systematic: facts, then rules, and, finally, inference mechanisms (a modified Rete algorithm). JavaBeans and associated (Jess) shadow facts are presented early. Rules elucidations include examination of "constraints" (literal, variable, connective, predicate, and return value); forward and backward chaining; and "managing the agenda." This helps make "Under the Hood" short and sweet. Suggested is a notion that Jess also can play non-ES roles: experimentation with Java APIs, a prototyping tool, and (entire) applications.

The heart of the book is a series of four relatively "large" examples and a final tract on Java Enterprise systems. The first example uses forward chaining for (US) tax forms recommendations and may, one could wish, have come earlier. Development issues, creating facts and rules and testing incrementally evolve as a plan for orderly code sequencing exploiting modules.

The second example takes Jess into backward chaining in a diagnostic system example. Flowcharts guide development and testing. Still, backward chaining in a system built for forward chaining seems inelegant at times, e.g., "special trigger facts" and backward chaining overriding for single patterns. A nice turn is how functions from the prior case study are adapted here and support a (Java Swing) GUI, while not exiting Jess! Changes are made incrementally, but for some readers, a complete solution up front and adequately explained could prove more palatable.

The third "large" example brings Java to the fore in a setting open to "reality:" a hardware-based C-dependent system accessible through Java's Native Interface (JNI)) with (a featured) Java simulator of it. A diagram aptly depicts heat pump and vent control systems; additional diagramming would help. Attention falls heavily on Jess' key Java-based extension method, a (two-method) interface, Userfunction. Though, as noted, the author touts testing from the start, it is halfway through a three-chapter treatment before testing gets a one-page blurb. The final chapter of the section presents the rules, according to plan: easier rules first, test, remaining rules and test. After this, about 15 pages on fuzzy rules provide a minimal introduction to the topic. A pseudo-code rule offering may evoke in the reader a desire for a translator from such to Jess.

In the first chapter of the next (fourth) section, Java Server Pages (JSP) and Servlets are evaluated against alternatives and elected for a purchase recommendation system: you buy a DVD player and the system recommends DVDs, etc. Discussion includes building rule (antecedent) patterns, arguing over ordering them within rules, incrementing order numbers, and cleaning up after (user-initiated) midstream cancellations. The jess.Rete (Java) class provides an "access point" to the Jess library to promote jess.Fact object manipulation in Java and allow more control than Jess alone. Exception handling and input-output end a discussion round. Remarks on a Linux setting, makefiles, the Tomcat Servlet engine, in small examples, make linking of pieces into a final target system proceed smoothly resulting in an architecture of one HTML file, three JSP files and three servlet files.

The final pair of chapters cover features of a standardization effort on the "javax.rules" API, which opens the J2EE (Java 2 Enterprise Edition) and J2SE (Standard) infrastructures to rule engines in general (i.e., beyond Jess). The API helps manage rules and Java-engine sessions. Coverage includes transforming XML rule representations to Jess (and back); the reader will undoubtedly be grateful for the former. In another tract, a Remote Method Invocation (RMI) server is employed to wrap a Jess system for network use. J2EE restrictions lead to a two-part solution: a remote (object) version of the Jess rule engineer (jess.Rete, again) and a factory class to create engine instances. The abbreviated treatment may lead to the reader begging for "more."

The book's emphasis is primarily on programming technique. Interleaved generalities about other ES aspects often seem awkward. These are well covered elsewhere and eliminating them here would provide about 100 pages for more ample development of, e.g., fuzzy systems, Java Enterprise, and balancing OO and rule features. A few misspellings and incomplete sentences seem minor relative to these evaluation points and to a perceived need for more diagrams and in-code comments.

Nonetheless, this is a good book, being comprehensive and yet generally readable. ``Why Jess given Java (and vice versa)?" gets a good answer. Said to be primarily designed for practitioners, the book can also be used in course work, with some judgement. It could be a bit intense for a single term. This reviewer's search for material for part of a term faces ever sterner choices. Homework or project suggestions are not given though it would be easy to supply them.