Eight years of age but going on about 35, Java has quickly entrenched itself in far-flung areas: peer-to-peer, open source, wireless, and embedded applications, to name just a few. It’s easy to lose track of where the language is going, because it’s headed everywhere at once.
For this series, I asked veteran Java developers to talk about trends they perceive as important. The first installment covered the Java Community Process and its bureaucratic issues. Now, we’re going to look at the increasing incidence of scripting languages in the Java realm and the pluses and minuses of using them.
It’s all about rapid development
No question about it: Scripting languages, such as Jython, Python, Perl, and PHP, are becoming more and more popular. Jython is actually a complete implementation of the Python programming language. It’s written in 100 percent pure Java and allows easy access to Java libraries.
This scripting trend is being driven largely by rapid application development (RAD), a development style that is gaining disciples all the time. As marketing executives put the full-court press on IT shops to speed production, IT managers are forced to look at the most efficient ways to beat deadlines. RAD is a prime mover here.
“You can be very clever with some scripting languages and do things you can’t do with regular Java,” said Mukund Balasubramanian, CTO of Redwood City, CA-based Infravio, a Java and Web services integrator. “If you know how to use a good scripting language, you can save a lot of time and money in development.”
The advantages of scripting languages
Balasubramanian said that scripting languages offer the following advantages:
- Rapid development: They shorten the “develop, deploy, test, debug” cycle greatly.
- Ease of deployment: Most offer drop-in deployment with no time-intensive compile/package cycles.
- Integration with existing technologies: They are built around component technologies like Java or COM to leverage the code.
- Easy to learn and use: Skills required are usually lower and easier to find in large numbers.
The disadvantages of scripting languages
However, Java scripting languages do have a few disadvantages:
- They are not comprehensive. They assume the presence of a “real” programming language; for example, you’d be hard-pressed to find a database driver built into a scripting language.
- They are not conducive to best practices in software engineering and code structuring, such as object orientation and component-based development.
- They are usually not “general purpose” but tuned toward a specific application, such as PHP and the World Wide Web.
“Thus, scripting languages can quicken the pace of software development to a very large extent, but must be carefully chosen for a specific application—such as dynamic Web pages or to complement a ‘real’ programming language like Jython to Java,” Balasubramanian said.
Third-party utilities help mesh scripts with basic framework
Utilities such as IBM’s Bean Scripting Framework make hooking Tcl, Python, Perl, and other scripting languages into a Java application fairly easy. Sun, Borland, BEA, and others also offer these utilities. But longtime Java developer David Kearns of Mentor Graphics in Wilsonville, OR, pointed out that there are time and cost risks with supporting a single scripting language, let alone a half-dozen of them.
In a recent article he wrote for Java World, Kearns described the risks inherent in supporting a scripting language in your Java application.
Other Java scripting languages
Here’s a rundown of the most widely used Java-oriented scripting languages, courtesy of Java guru William Wagers of About.com:
Jess is a rule engine and scripting environment written entirely in the Java language. Jess was originally inspired by the CLIPS expert system shell but has grown into a complete, distinct, dynamic environment of its own. Using Jess, you can build Java applets and applications that have the capacity to “reason” using knowledge you supply in the form of declarative rules.
JudoScript is a Java-type script that features HTTP client and server programming, file system and archiving, XML and XSLT scripting, JDBC scripting, and HTML scraping. It also sports a scheduler with monitor, sendmail, run executables, Java GUI creation, FTP, SSH and SCP, Windows registry, etc. Software download, including source, is free.
Is scripting the future of Java?
Do you think that scripting is planted firmly in Java’s future? Post your comments below or e-mail us.