Features of a Scripting Language


Scripting languages lack the formal semantics of conventional languages like Java. They are loosely typed and highly dynamic, two features which make them ideal for noncritical project tasks.

The main features of a scripting language include

  • High level and informal language constructs

  • Expressive syntax

  • Loose typing

  • Interpreted as opposed to compiled

Over the years, the software industry has spawned a large number of languages that exhibit these features, a testimony to the benefits of scripting languages. There are many well-known and highly regarded examples:

  • Python

  • Perl

  • Ruby

  • Tcl

The biggest question facing a J2EE project team is which language to choose. The following lists some points to consider when making the choice. Does the language

  • Complement the experience of the project team?

  • Offer crossplatform support?

  • Integrate with Java, allowing access to existing Java classes?

In addition to these points, characteristics such as the language's maturity, performance, and quality must also be considered.

Team Experience

With a number of languages to choose from, looking to assess the expertise of members of the team with a particular scripting language is an important consideration. Although offering powerful language constructs and informal semantics, scripting languages are not easy to learn. They employ many concepts that are not available in Java, meaning training time must be set aside to bring a developer up to speed.

Tip

If the team is skilled in a language such as Python, then adopting Jython, the Java equivalent, is one way of leveraging that previous Python experience.


Investment in the education of a team in a particular scripting language should be part of a company's wider adaptive foundation for rapid development. Standardization on a common scripting language across project teams allows the sharing of scripts and modules between groups. Staff will also be available in a mentoring role for projects using the scripting language for the first time.

Crossplatform

Not all of the main scripting languages are crossplatform. Scripts can be migrated between machines with different operating systems and architectures only if an interpreter for the language exists for the target platform.

Java offers crossplatform support, and it would be preferable if a scripting language were available that offered the same capability. Language builders have addressed this problem by developing scripting languages that execute under a Java Virtual Machine (JVM). Thus, the language is supported on any platform that can host a JVM.

Several languages are available that fall into this category. Table 9-1 lists some of the open source offerings.

Table 9-1. Scripting Languages for the Java Platform

Name

Description

Reference

Groovy

New language that combines many popular features from languages such as Smalltalk, Python, and Ruby

http://groovy.codehaus.org/

Jacl

Jacl (pronounced Jackal), or the Java Command Language, is a Java implementation of the Tcl scripting language

http://www.scriptics.com/software/java/

JRuby

Java implementation of the popular Ruby scripting language

http://sourceforge.net/projects/jruby

Jython

Java version of the object-oriented scripting language Python

http://www.jython.org

Rhino

A JavaScript interpreter written entirely in Java

http://www.mozilla.org/rhino/


Several of the JVM scripting languages are implementations of popular scripting languages; for example, Jython brings Python to the Java platform, and JRuby is a Ruby implementation. Other languages, such as Groovy, have been created specifically for the Java platform.

Integration with Java Classes

For tasks such as writing ad hoc reports, producing automated test cases, or building user-interface prototypes, the scripting language must have the ability to work directly with Java objects.

This is the main reason for choosing a Java-based scripting language over one of the established languages. Without Java integration, many common scripting tasks are far more cumbersome, thereby negating the use of the scripting language.

To appreciate the relationship between scripting language and Java, the next section introduces Jython, a scripting language that is tightly integrated with the Java platform.



    Rapid J2EE Development. An Adaptive Foundation for Enterprise Applications
    Rapid J2EEв„ў Development: An Adaptive Foundation for Enterprise Applications
    ISBN: 0131472208
    EAN: 2147483647
    Year: 2005
    Pages: 159
    Authors: Alan Monnox

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net