Skip to main content

Double Vision

Posted by editor on September 20, 2007 at 7:31 AM PDT

Why program in one language when you can use two?

Presumably, by this point, everyone's sufficiently comfortable with the idea of running scripting languages in Java, as formalized by Java SE 6's javax.script package, that we can all look beyond the novelty of running a scripting language on the JVM and get into the bigger question of what you can do with this ability.

It's one thing to just run an application written entirely in another language in a JVM interpreter, like deploying your Ruby apps on JRuby. What's potentially more interesting is interspersing scripting langauges into your otherwise-Java apps where they make sense. Imagine, for a moment, that you have some part of your functionality where you look at it and think "I really wish I could use something other than Java for this." For example, if you needed to crunch some logic with a rule engine, you could use Drools, but you might also consider just switching to Prolog for that part of your functionality. A deeply recursive problem might be well-suited to LISP/Scheme. And I'm sure you can think of more examples, perhaps involving domain-specific languages.

But is there an art or a science to mixing interpreted languages into your Java code? Can you still maintain a clean, object-oriented design while adopting languages that lack Java's formalities? Scripting in Java author Dejan Bosanac dives into this question in today's Feature Article, in which he writes about

Scripting With Balance in Design and Performance:

When thinking about scripting languages in Java applications, two key questions come up: how it will affect software architecture and how will it affect performance. By keeping the design with interface principle at our focus and applying simple patterns shown in this article, we can successfully tackle both of these questions. The rest is left to you to choose what language best suits your programming needs, but also when and how much scripting you want to use in your projects.

In Java Today,
InfoQ has posted a review and excerpt from Filthy Rich Clients, the new book by Chet Haase and Romain Guy. Reviewer Andy Roberts writes, "the term "Filthy Rich Clients" was only coined relatively recently by the authors to describe "applications that are so graphically rich that they ooze cool. [...] In short, they make users actually enjoy their application experience". With that in mind, the book goes on to explain how to utilise Java2D and Swing in order to enhance your desktop applications."

David Dagastine blogs that he'll be presenting a Sun HotSpot JVM Talk at Intel IDF today in San Francisco. "'ll be presenting tomorrow at Intel Developer Forum in San Francisco with an esteemed colleague from Intel, Kingsum Chow. The session is SSGS003: "How to Get the Most Performance from Sun JVM on Intel Multi-Core Servers"." Along with an overview of how HotSpot takes advantage of current and future Intel multi-core CPU's, the talk will offer "a look at how to select JVM parameters for your application to get the most performance, and at employing VM parameters tuning as a last resort."

The ever-interesting Bruce Eckel is back with a surprising criticism of one of the net's most popular standards, in RSS: The Wrong Solution to a Broken Internet. "RSS seems clever close-up, if you ignore the internet traffic increase issues. But if you look at the real problem, RSS is a workaround that just supports the existing problem: anonymity." He goes on to argue that the need for privacy prevents a far more efficient publish-and-subscribe model, and instead forces RSS clients to reply on inefficient and bandwidth-wasting polling.

Terrence Barr files a Brief Report from the Open Source in Mobile conference in today's Weblogs. "Fragmentation in the mobile Linux market is a major problem and is weighing heavily on people's minds (Java ME fragmentation looks relatively harmless in comparison). It may well turn out that Java will again be the unifying language and API that hides the fragmentation of the Linux platform and middleware."

Carla Mott's
How to implement data pagination in jMaki tables was inspired by the fact that
"the question about paging through data in a table comes up enough that I decided to answer in a blog."

EclipseZone writes about NetBeans winning "bossie" award, Dru Devore writes,
"there is a good article at EclipseZone on NetBeans winning the bossie award. It is a fair article and was an interesting read."

In today's Forums,
ntruchsess announces an interesting project in
Re: JSF with AJAX.
"I've written a new style of integrating the JSF-serverside into jMaki publish/subscribe. It allows to receive messages published on the client by a 'JMakiEventListener' attached to the 'widget'-tag. In the response it allows to send back any number of messages to be published on the client. In addition to this, you can do Dynafaces partial-page-update at the same time. Due to the Dynafaces-dependency it currently only runs on JSF 1.2 (both Facelets and JSP) though check out to read more!"

osbald points out some visual issues with SwingX and
"Just wondering if it should be.. or should the JXComponents honour the same system properties the default components do. It is visually jarring when you mix JComponents with JXComponents under 5.0. 6.0 Would turn on the sub-pixel antialiasing (under windows at least) is that true for JXComponets too or do they stick to their own (what I guess is java2d) aliasing Maybe its just me, but if I've no immediate plans to use a painter etc.. I'll always use a JButton or JLabel over an JXButton or JXLabel."

jslott has some markup suggestions for the Project Wonderland file format in
Re: First WFS implementation.
"Mulling over my mind I would like to suggest: we design the XML file format to be as simple as possible, rather than be a reflection of some member variables currently used by the Cell GLOs. As Jon suggested, that means for example breaking the Matrix4D into separate parts -- and I would take it a step further by saying we should use basic data types (int, double, string, array) wherever possible. So, an 'origin' would be given by a double array of length 3, rather than a serialized version of the Vector3D class. We would still use the XML persistence mechanism however."

Current and upcoming Java

Registered users can submit event listings for the href=""> Events Page using our href="">events submission form.
All submissions go through an editorial review before being posted to the

Archives and Subscriptions: This blog is delivered weekdays as
the Java
Today RSS feed
. Also, once this page is no longer featured as the
front page of it will be
archived along with other past issues in the href=""> Archive.

Why program in one language when you can use two?