views:

128

answers:

2

I would like to develop some apps for the JVM using a concise, dynamic language. The most popular choices for this seem to be Jython, JRuby, Groovy, and maybe Clojure.

Rhino appears to be fast and very stable, but I see no books on Rhino development and little discussion. Why is there apparently little use of JavaScript for other than embedded scripting?

Edit: I found this question informative on the viability of Rhino-based development.

+1  A: 

I have never used Rhino so I can't offer technical reasons, but as a generic programmer, I can offer up a pop psychology theory:

For most of its life, javascript has been strictly a client side language, at least in people's heads. Even worse, it seemed like a crappy one, because there were always problems on web pages with javascript. These problems weren't necessarily the fault of the language so much as how the browsers implemented it, how they organized the dom, and what we were able to access through javascript. But in our heads we began to think "javascript has issues" or even just "javascript is limited in what it can do".

So despite all the high level magic some people can do with it, many of us think of javascript as a toy language, from our early memories of the web where all it could do was make an image change on a mouse rollover.

Finally, for a language to become popular,(especially when lacking a huge corporate sponsor) it needs to have some tangible benefit over the existing ones. There are already a lot of server side languages, frameworks, and runtimes competing for people's attention. What is so special about javascript that people should throw away their investments in technology X that they already use? (that's not a dig at js, just food for thought)

Peter Recore
also, have you considered scala? It is not dynamic in a strict sense, but gives you most of the benefits of a dynamic language anyway.
Peter Recore
I like prototyping with Lua. JavaScript semantics are close enough to give me warm fuzzies.
+2  A: 

I've used Rhino as a part of a production-grade VoiceXML interpreter written in Java and running on the JVM. It works extremely well for this purpose. If I were reimplementing this interpreter from scratch, I would have leaned towards doing even more of my development in JavaScript. So it's definitely an option. You'll need to explore how mature the surrounding libraries are for your application area (you can always write logic that calls out from JavaScript to Java libraries, but that might be too laborious).

But I also agree with @Peter Recore: do give the other JVM languages a second look. I'm impressed with the object-functional Scala language: its performance is nearly as good as Java, and it has a lot of expressive power.

Update: Good books to read on JavaScript are: JavaScript: The Definitive Guide and JavaScript: The Good Parts. The only Rhino-specific stuff you'll need is here.

Jim Ferrans