This is the mail archive of the kawa@sources.redhat.com mailing list for the Kawa project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Scripting business logic using kawa/scheme


Bhinderwala, Shoeb <SBhinderwala@wellington.com> wrote:
> I would like to evaluate kawa/scheme for a re-design and simplification of
> our current application to see if it is a good idea to use it, and if others
> have applied it to similar problems.

We went through a similar evaluation process and picked Kawa
over many options.  We have been extremely happy with Kawa and
would definitely choose it again.

> What would be the advantages of kawa/scheme over other scripting languages
> that also integrate with Java like JPython (based on Python) and Jacl (based
> on Tcl).

We ultimately chose Kawa for a variety of reasons, but Python is
a nice language and Jython is a nice implementation.  I don't
have any experience with Jacl.  Of course, those of us answering
this question are a self selecting group of people who really
like Kawa and Scheme - otherwise we wouldn't be on this list!

For us, these were the main reasons we picked Kawa:

- For our initial problem having an expression based language
  like Scheme was a real win.  Python would not have fit quite
  as nicely.
- Kawa is very fast and the code is easily tuned.  This was
  important since the initial problem had expressions deep
  inside an inner loop.
- It is very simple to integrate Kawa and Java.
- We just like Lisp!  And Scheme is a nice clean dialect that
  novices can understand.

> The only issue is that non-technical users should be comfortable writing at
> least basic scripts (consisiting of boolean operations). 

This is our primary audience and they have no problem writing
simple multi-line expressions.  We have found that if we teach
them some simple syntax rules and give them a set of examples
there are successful.  But, if we start out by saying that we're
going to teach them how to program in this great new Scheme
language and talk to them about the theoretical underpinnings of
Scheme they are unsuccessful.  The lesson for me was that the
business users didn't really want to program, they just wanted
to solve their problem.

> Is kawa/scheme suited to solve this type of a problem. Essentially - to move
> out business logic/rules from the application to scripts - so that it is
> easy to create, modify, and maintain (even by non-technical users).

That's what we do.  We actually now have four or five different
domain specific languages that we use.  These DSLs run the range
of JavaCC, pure Scheme, an sexp based language with a way to
escape into Scheme, and an sexp language with only a few
operators allowed.

>     (Security.IsEquity() AND Issuer.MarketCap() < 5000000)

Ah yes!  a very familiar idea.  Here's what we do:

        (and (equity? security) 
             (< (market-cap-of issuer) 5000000))

This gets typed into a text file, an XML file, or put in a
database using an interactive web-form.  At runtime, we load up
the expression, compile it, and run it from Java.

> PS: Here is an informative article on Java scripting languages:
> http://www.javaworld.com/javaworld/jw-04-2002/jw-0405-scripts.html.

It can't be that good if it doesn't mention any of the Java based Schemes!

Regards, 
Chris Dean



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]