The Design of Software (CLOSED)

A public forum for discussing the design of software, from the user interface to the code architecture. Now closed.

The "Design of Software" discussion group has been merged with the main Joel on Software discussion group.

The archives will remain online indefinitely.

Rhino as compared to Jython...

I have worked with both these langauges and maybe because I have a C/Java background, I rather liked the way one can use Javascript to script and use Java's libraries.

Jython seemed a little unfamiliar in that the syntax is Python like.

Just wondering what other people have to say on this, I mean from what I have seen, Jython gets more coverage than Rhino despite the fact that when scripting Java, Rhino is way more close to Java in terms of feel and syntax.
tss
Saturday, May 13, 2006
 
 
howEVER... Jython compiles to Java bytecode, whereas Rhino is a JavaScript interpreter written in Java.

As such, Jython is orders of magnitude more performant than Rhino.

The only circumstance where I'd ever consider using Rhino is if I needed to provide a scripting API to some set of casual users. (For slightly more sophisticated users, I'd just provide a set of Java interfaces that they could implement to extend the functionality of an application.)

Here's an interesting article:

http://tinyurl.com/pda37

Though pay particular attention to this quote, from page 3:

"...as would be expected, real compiled Java code is roughly 100,000 times faster than the interpreted JavaScript..."

Yikes.
BenjiSmith Send private email
Saturday, May 13, 2006
 
 
Benji,

With the preformance stats you quoted, I would seriously think twice about using Rhino in a production setting, but what do you think about Rhino being used for prototyping, wouldn't Rhino be suited to that kind of application ?

I am able to test design ideas, prototype etc rather rapidly in Rhino and I like the feel as well.
tss
Saturday, May 13, 2006
 
 
Here's an interesting link with some benchmarks involving half a dozen scripting langauges. Rhino seems to be doing quite well in those benchmark.

http://pnuts.org/benchmark/pnuts.org/
tss
Saturday, May 13, 2006
 
 
Well, personally, I like to prototype in the same language I'm targeting for implementation. That way, when the prototype has successfully demonstrated the merits of the software concept, I can acutally use much of the prototype code in my final implementation.

Rewriting a bunch of code just to move a prototype into production isn't my idea of fun.

And I'm skeptical the that round-trip prototyping process in JavaScript would be much more rapid than the same process purely in Java, especially with an IDE like Eclipse that knows how to perform refactoring transformations (and where you can execute your code anytime with <CNTRL-F11>.

Easy peasy, lemon squeezy.
BenjiSmith Send private email
Saturday, May 13, 2006
 
 
From the Rhino site (http://www.mozilla.org/rhino/overview.html):

"Rhino contains:

  * A JavaScript compiler to transform JavaScript source files into Java class files"
Chris Winters Send private email
Sunday, May 14, 2006
 
 
"Rhino contains:

  * A JavaScript compiler to transform JavaScript source files into Java class files"

Hmm, I wonder what Benji has to say on that...
tss
Sunday, May 14, 2006
 
 
I say "sounds cool". Give it whirl and tell us what you think about it.
BenjiSmith Send private email
Sunday, May 14, 2006
 
 
We use Rhino in a production environment. Our system has a messaging component that requires customer-specific script for 'massaging' data. We chose to run Rhino interpretted (as opposed to creating Java class files)... Sadly, I forget why but I seem to remember there being some serious limitations to using it's bytecode generation feature.

Jython seems interesting and it's possible we'll take a look at it, but depending on what your performance needs are.. you may not care. We run 100+ messages a second through our scripts... which is more than fast enough.

Fast vs. Faster doesn't mean anything if you don't know what your requirements are.
Phill Send private email
Monday, May 15, 2006
 
 
Prototyping with Rhino can be fun. No need to compile code, just script with rhino and run it. Tweaking scripts is easy and fast and that's great for experimenting with Swing, SWT, or any other library you're curious about. Speed has never been an issue for me while prototyping and is quite satisfactory. Unlike web pages, the thought I'm waiting never enters my mind. The sytax for implementing interfaces and dealing with events in scripts may seem odd at first but soon becomes habbit.

Tip: I've modified the file type action on Windows so JS files can be executed from the context menu. Similar automations can also be made in VIM, Jedit, or whatever super editor you use.
Nonymous
Wednesday, May 17, 2006
 
 

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics
 
Powered by FogBugz