File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Jython/Python and the fly likes Using Jython for the Interpreter OOPattern Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Languages » Jython/Python
Bookmark "Using Jython for the Interpreter OOPattern" Watch "Using Jython for the Interpreter OOPattern" New topic
Author

Using Jython for the Interpreter OOPattern

Kyle Willkomm
Ranch Hand

Joined: Sep 10, 2001
Posts: 44
Hello, I work for a software company that has a lot of business rules to process, these rules change very often and look something like a lot. They are datamapping rules that usually say something like, "this xml tag map's to this EDI field in memory." The rules are written in our own "Business Rule" language and were designed to look like VB. Our server that accepts XML orders from our clients and interprets these rules in order to process a transaction and put it in a form it needs to be to leave our back end. These rules are stored in a database currently and are read into memory when the order processing server starts up. As you can see these rules are not compiled and or, without a doubt, the slowest part of our transaction processing and very CPU intensive. Each order is taking almost 8 CPU seconds each. This is greatly hurting scalability to the point where we can only have about 1 server/thread per CPU. If you do the math that turns out to 7.5 orders/minute per CPU. We aren't going to scale very well at that rate. So I am exploring alternatives. Our current thoughts are to write our server and rules in either Java or Perl. In either case the rules will be able to be compiled or, in the case of Perl, "Professionally Interpreted," well say. Which we assume would be faster then our current home grown interpreter written in C++. My question is, does this seem like a good candidate for Jython? Is Jython thread safe? Would Jython give us what I think it would, a simple clear language to write business rules in, and a free, high quality interpreter to get them compiled and running quickly? I know that was a load of information, thank you for your time.
David Weitzman
Ranch Hand

Joined: Jul 27, 2001
Posts: 1365
It sounds like the developers are comfortable in a wide range of languages and not tied any one in particular (or even the Java platform).
While I get the impression that Jython is allows brief code and excellent Java integration, according to this benchmark it only slightly outperforms the Rhino JavaScript engine. You might find that JavaScript is more familier to the people who will deal with the software now and in the future (I like to think of JavaScript as baby Perl implemented with the general Java/C++ syntax -- all languages you mention above).
Just a factor to take into consideration.
Robert W Bill
Author
Greenhorn

Joined: Apr 08, 2002
Posts: 21
I have seen java apps define rule sets in Jython and thought it worked very well. I don't think the runtime speed between rhino and Jython is enough to matter, and I think either would work great.
The ease of embedding the Jython interepreter makes this kind of work nice.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Using Jython for the Interpreter OOPattern