• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Junilu Lacar
  • Liutauras Vilda
Sheriffs:
  • Paul Clapham
  • Jeanne Boyarsky
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
Bartenders:
  • Jesse Duncan
  • Frits Walraven
  • Mikalai Zaikin

Ernest: Motivation for the Jess book

 
Ranch Hand
Posts: 3404
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Ernest,
Following the thread in the "General Computing" Forum, I'll ask the question again.
What motivated you to create Jess ?
regards
 
author and iconoclast
Posts: 24204
44
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
From the Preface to Jess in Action (this and more book exceprts available at
http://www.manning.com/friedman-hill/:
In 1994, I was working in the Scientific Computing department at Sandia National Laboratories in Livermore, California. We had an impressive (for the time) array of heterogeneous computing equipment: workstations from Silicon Graphics and Sun Microsystems, Intel PCs running Linux, Macintoshes galore. I was writing software agents that managed dynamically distributed computations across this network. Agents were running on each machine, and they used a sort of �post and bid� method to decide which machines would run which piece of a computation, based on machine capabilities and load balancing. The agents were fairly intelligent in their decision-making capabilities, and the plans they developed were sometimes surprising. Their �brains� were rule engines�software systems that used rules to derive conclusions from premises.
That project led to others, and soon I developed an interest in mobile agents�software entities that can travel from node to node in a computer network, maintaining their state as they go. Thus was born the idea for a rule engine whose state could be packaged up, sent across a wire, and reconstituted. The newly released Java language seemed to be a perfect vehicle for this rule engine�and such was the origin of Jess�, the rule engine for the Java Platform.
 
HS Thomas
Ranch Hand
Posts: 3404
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks.
Can you give examples,please, of uses of rule engines in the J2EE environment ? I am thinking of business uses, what types of agents.
regards
[ September 02, 2003: Message edited by: HS Thomas ]
 
Ernest Friedman-Hill
author and iconoclast
Posts: 24204
44
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
[ From this thread: ]
A practical programmer's example:
Imagine you are writing a program which receives customer orders, formats them, sends them to a warehouse to be filled. Each order is a list of items with quantities, a customer, and a date. You write the program, everything is great.
Boss comes in, says, "Give a 10% discount to everybody who spends more than $100." Great. You add a single if-then statement, recompile, boom. You're back in business.
Boss comes in, says, "Give a 25% discount on items the customer hasn't bought before." OK, well, you've got to add some database queries, but soon enough, you're back in business.
Boss comes in, says "Revoke 10% discount per-order, make it 10% if you spend $250 a month or more. Also, if somebody buys a CD writer, send them a free sample of CD-RW disks; but only if they're a repeat customer. Oh, and by the way, we need to price shipping based on geographic zone, except for people with multiple locations..."
After a few weeks of this, if you've been using traditional programming techniques, your code is a gnarled mess -- and it's slow too, as it has to do all sorts of database queries for each order that comes in.
If you're using a rule engine, though, you've got nice clean code, with one rule for each pricing policy. If somebody need to know where the "Wacky Wednesday" pricing policy is implemented, it's easy to find it.
If you're using a Jess-like system, it's not slow, either; the rule engine itself indexes all the orders and no lookups are required; the rule engine just "knows" what it needs to know about past orders.
 
Ranch Hand
Posts: 8944
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ernest
Nice example! Why isn't Jess famous if it has several uses? :roll:
 
HS Thomas
Ranch Hand
Posts: 3404
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What does a developer need to know to program in Jess ?
Which leads to the next question.
How does Jess remember past orders ? ( taking your excellent example).
regards
 
Pradeep bhatt
Ranch Hand
Posts: 8944
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What is the environment required for jess?
 
Ernest Friedman-Hill
author and iconoclast
Posts: 24204
44
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
H.S. Thomas:
What you need to learn Jess is, of course, a copy of Jess in Action!
To integrate Jess into Java software (which is Jess's reason for being, really) you obviously need to know Java.
Jess remembers past orders (i.e.,in the example above) in its "working memory," kind of a built-in database. Working memory can be in-core, or it can be paged out into a database or flat file, as needed.
Pradeep Bhat:
Jess is a J2SE-based library, so you can use it pretty much anyplace Java will work. People have gotten older versions of Jess to work on Windows CE, and plenty of people use Jess inside J2SE apps, so it pretty much runs the gamut.
 
HS Thomas
Ranch Hand
Posts: 3404
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is Jess secure enough for most applications ? The working memory appears to be a problem at first glance.
regards
 
Ernest Friedman-Hill
author and iconoclast
Posts: 24204
44
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How so?
 
HS Thomas
Ranch Hand
Posts: 3404
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

or it can be paged out into a database or flat file, as needed.


These , potentially , can be tampered with by bad-intentioned folks.
Depending on the environment it may not be an issue but could well be a feature. As long as people are made aware of the strengths vs limitations.
Is security covered in the Jess book ?
regards
 
Ernest Friedman-Hill
author and iconoclast
Posts: 24204
44
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This kind of paging is something that you can do with Jess; it's not a specific feature of Jess per se. Remember that besides being a rule engine, Jess is an entire programming language; it's so flexible that saying some feature or other is secure or not is like saying Java (or C++ or Smalltalk or...) is secure or not. Things can be done securely, or not, as the case may be.
 
HS Thomas
Ranch Hand
Posts: 3404
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Excuse me for not grasping that earlier.
Would you be able to give us a (simple) example of the syntax?

You could use the example given above, that way we'll be able to follow.

regards
 
Ernest Friedman-Hill
author and iconoclast
Posts: 24204
44
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, this is just off the top of my head, but...


Each order is a list of items with quantities, a customer, and a date.


Let's assume that you've got Java classes Item, Order and Customer.
You have to tell Jess about these classes:

Then you can write rules to deal with these.


Boss comes in, says, "Give a 10% discount to everybody who spends more than $100."


This trivial rule might look like

Then:


Boss comes in, says, "Give a 25% discount on items the customer hasn't bought before."


You might write

Obviously, you have to learn the language syntax -- but it's a syntactically very regular language, and easy to pick up.
 
HS Thomas
Ranch Hand
Posts: 3404
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Why the name, Jess ?
Can Jess be used as a substitute to EJB-QL ? And can you map inheritance with Jess ?
An example , please.
regards
[ September 02, 2003: Message edited by: HS Thomas ]
 
Sheriff
Posts: 6920
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Why the name, Jess ?
I can answer that one, it stands for "Java Expert System Shell".
Can Jess be used as a substitute to EJB-QL ?
I wouldn't suppose so. And even if you can, it would be quite strange to do so. a rule-based system and a data query language are very different things.
 
Ernest Friedman-Hill
author and iconoclast
Posts: 24204
44
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


Why the name, Jess ?
I can answer that one, it stands for "Java Expert System Shell".


It used to stand for that; then it was written "JESS". But now, it doesn't stand for anything; it's just "Jess". Sun legal doesn't like you to name things "Java Blah".
 
HS Thomas
Ranch Hand
Posts: 3404
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

I wouldn't suppose so. And even if you can, it would be quite strange to do so. a rule-based system and a data query language are very different things.


So, if I am working on an EJB development project (I wish) then does that rule out using Jess ? I just wondered if anyone has tried this ? I may need a single component that requires different rules applied depending on the data ? The outcome will be the same, ie a discount is applied.
regards
 
Ernest Friedman-Hill
author and iconoclast
Posts: 24204
44
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


So, if I am working on an EJB development project (I wish) then does that rule out using Jess ?


Oh, no, not at all. Many projects are using Jess in J2EE software with EJBs. Also note that many people use EJBs without using EJB-QL!
EJB-QL is one way of finding particular entity beans. This is indeed something that Jess's rule language can do, too. But in fact, Jess and EJB-QL could be used in complementary roles in the same application. EJB-QL can be used with Jess's backward-chaining mechanism to automatically and transparently load relevant objects into working memory, as needed.
Jess is a very flexible rule engine, in that it can be used in the J2EE environment and also in desktop and embedded applications. There are other Java rule engines on the market that are really only intended for J2EE use -- most of them, in fact.
 
HS Thomas
Ranch Hand
Posts: 3404
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Ernest. That answered my question.
Can one get an evaluation copy of Jess, the software ? The book is making it's way to the top 10 on my wish list.
regards
 
Ernest Friedman-Hill
author and iconoclast
Posts: 24204
44
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you buy the book, you can download the "Jess Special Edition" from Manning's web site. Meanwhile, you can get a trial version right now from http://herzberg.ca.sandia.gov/jess .
 
Frank Carver
Sheriff
Posts: 6920
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
now, it doesn't stand for anything; it's just "Jess".
Aww, go on. How about one of those GNU-style recursive acronyms?
Jess = "Jess Expert System Shell"
 
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Maybe the name of the topic was wrong, but really:
What did motivate you to write the book?
which were the difficulties and experiences?
regards
 
Ernest Friedman-Hill
author and iconoclast
Posts: 24204
44
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a very good answer as to what motivated me to write the book: there were no good, tutorial examples of building real rule-based systems in the literature, and I think for something as hard to explain as "How do I build rule-based software?" examples are the best way to learn. Many, many people had asked me over the years if I knew of any realistic, well-documented examples they could study, and there just weren't any available -- so I wrote the book. I'm really pleased at how it came out.
 
pie. tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic