Programming Tutorials Browser Tutorials Articles Struts Tutorials Hibernate Tutorials

  Tutorial: Jython

Get to know Jython, in this first article in a new series introducing alternate languages for the Java Runtime Environment, alt.lang.jre. Jython is an implementation of the popular scripting language Python, but running on a JVM. For Python developers Jyt

Tutorial Details:

Features of Jython
Jython syntax is line-oriented and similar to English while fully supporting the structured and object-oriented programming styles of languages such as Java and C++. Jython code can be directly interpreted or it can be translated to Java source that is automatically compiled to class files (see Resources). Compiled Jython classes can be executed independently from the Jython interpreter or used from Java code as if they were Java classes (for example, to develop applets or servlets).

As previously stated, Jython's productivity is its strongest asset. Some of the unique features of Jython (as compared to the Java language) are as follows:

Code can be entered and run line-by-line in interactive mode, which can improve learning and promote experimental use.

Variables are dynamically typed on assignment, so there is no need to pre-declare variables or use the new operator. These enhancements can significantly increase programming flexibility and also reduce the text size of your programs, thus increasing your productivity.

String operations are extensive and easily accessed (for example, x == y in Jython is the same as x.equals(y) in the Java language).

Adapter objects are automatically generated and automatically provide default Java interface implementations, making it much easier to implement event handler callbacks.

Natural indefinite precision integer values (that is, trivial access to a java.math.BigInteger-like type) and natural complex values allow Jython to easily support many more mathematical applications than are supported by the Java language.

Dynamic attributes (each class instance acts like a Java Map) allow far more dynamic class functionality.

Enhanced importing (like Java 1.5's import static) increase flexibility and modularity.

Classless and mainless (that is, open) code increase productivity for procedural programs (such as scripts).

Multiple public variables, functions, and/or classes per source file reduce the number of source files you must maintain, which simplifies large-scale development.

Default arguments on functions and methods greatly reduce the number of overloaded methods you need to create.

Keyword arguments on functions and methods increase the self-documentation and flexibility of your code.

Functional programming (functions are first-class objects) provide a very powerful and flexible style of programming that is lacking in the Java language.

Multiple inheritance supports a much richer inheritance hierarchy for the problems that require it.

Operator overloading allows new data types to be created that seamlessly integrate into the language.

This list gives you a good overview of the structural utility of Jython. In the sections that follow, I'll describe some of the elements that comprise Jython's productivity advantage -- namely data types and statement types.


 

Read Tutorial at: Click here to view the tutorial

Rate Tutorial:
Jython

View Tutorial:
Jython

Related Tutorials:

Java scripting languages: Which is right for you?
Java scripting languages: Which is right for you?
 
Related Values Processing Framework (RVPF)
Related Values Processing Framework (RVPF) Overview The Related Values Processing Framework is being developed to help the integration of Process Control Data Historian Systems. This is done by providing support for the conversion, computation and di
 
Jython
Get to know Jython, in this first article in a new series introducing alternate languages for the Java Runtime Environment, alt.lang.jre. Jython is an implementation of the popular scripting language Python, but running on a JVM. For Python developers Jyt
 
alt.lang.jre: Take a shine to JRuby
JRuby combines the object-oriented strength of Smalltalk, the expressiveness of Perl, and the flexibility of the Java class libraries into a single, efficient rapid development framework for the Java platform. In this third installment in the alt.lang.jre
 
Groovy, Java\'s New Scripting Language
Groovy, Java\'s New Scripting Language When some Java developers hear about Groovy, their first reaction often is, as mine was, "Oh, no, not another scripting language for Java." We already have, after all, JavaScript and Rhino, Jython, Jelly, BeanShell,
 
Site navigation
 

 

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright © 2006. All rights reserved.