JudoScript: Scripting for Java and Beyond

The creator of JudoScript explains the need for and the benefits of a good scripting tool for Java.

The Java platforms (J2SE and J2EE) are filled with rich and useful features, making Java an extremely useful resource for more than mere programming. To use Java, a good scripting tool is needed. JudoScript was developed to fill this need. It is a third and fourth generation tool (3GL and 4GL), providing normal programming support. In addition, it provides special mechanisms for various computing needs, such as Java scripting, JDBC scripting, XML scripting, HTML/SGML scraping, file and archive manipulation, versatile command-line execution, scheduling, HTTP handling, Java GUI scripting and many other utilities. JudoScript also is programmer-friendly and supports thread programming, useful data structures and so on. Its programming model is similar to that of Java and Python.

Background

JudoScript was first released in November of 2001. You may wonder why we need a new scripting language? The truth is, with Java, we do not need another programming language, but we do need a good scripting tool.

Going through the Java packages shipped with J2SE and J2EE, one finds functionalities from basic computing to enterprise computing. Open-source projects provide even more cool functionalities, so we can do SSH/SCP, PDF generation, FTP, Telnet, Windows registry, UNIX syslog and much more. All in Java, Java has become a vast pool of readily usable resources for any platforms that runs it.

Coding in Java, however, is not a feasible solution. Often times we need to quickly fix up something, such as going through a directory tree to do some file manipulation, or checking a database for unprocessed orders or retrieving information in an XML document to create a report. For these types of one-time actions, rigorous Java coding is an overkill. Other times, we create scripts for repetitive tasks, which are run either manually or automatically. These scripts update frequently and performance is not critical. Edit-and-run can drastically improve productivity and reduce stress.

Another problem is the verbosity of Java programs. Java is a so-called system language, with low-level, fine-granularity APIs and language constructs that enforce good software engineering. But these elements become obstacles in our situations. On a related note, coding in Java requires expertise that is at times not available or desirable. Imagine trying to put a few files into a ZIP file using Java, without prior knowledge of the java.util.zip package. You would need to understand the files' meanings and relationships before you could do anything with them. As a user, I know Java can do ZIP files, but I don't really care whether java.util.zip.ZipFile or bill.wonderutils.ZipArchive is used.

So, really, what we need is a good scripting tool that allows us to easily use the many features in Java, standard or open source, with maximum flexibility (i.e., programmability) and extensibility.

Current Ideas about How to Script for Java
  1. Use Java as scripting. A few projects use Java as-is for scripting. This idea misses the fact that Java is a system language; edit-and-run alone does not legitimize Java as a scripting language.

  2. Clone Java for scripting. Beal Shell and JavaScript fall into this category. Their syntax is designed to come very close to Java, but they use typeless variables. This helps in certain coding situations, but it doesn't meet our needs for using Java and beyond.

  3. Port existing languages to Java. JavaScript, Python and TCL are a few examples. These are considered 3GLs. Again, they are not good enough to use Java's rich functionality. We need something better.

JudoScript's Language Design

The easiest way to solve problems is to tell an expert and have him do it for you. This idea reflects the philosophy of so-called 4GLs, which are domain-specific languages. They allow users to specify intentions, and the language engine provides solutions automatically. A typical example is SQL. You write a query; the SQL engine returns you rows of data. You don't need to open tables, locate available indices, check against the rows and create a cache for large amounts of data.

Opposite of 4GLs, 3GLs allow programmers to specify solutions in the form of algorithms. Most major programming languages, including scripting languages, are 3GLs. 3GL design is what I refer to as "orthogonal"; that is, the language has a small core syntax set and a standard extension mechanism (usually known as library or package) that allows the language to expand in functionality. Thus, a 3GL has few functionalities and uses on its own; they almost always come with a standard library to make it minimally useful, such as the C run-time library, standard Java packages and standard Python packages. This type of design fulfills the beauty of minimalism, at the expense of ease-of-use for non-coders (or coders who prefer not to code all the time).

JudoScript, on the other hand, embodies a special syntax for popular modern computing areas, such as JDBC scripting, sendmail, HTML/SGML scraping and GUI scripting. In other words, it takes a 4GL approach for popular functional areas. Because of such intimate support, scripting in these areas is more effective and elegant.

JudoScript is a genuine 3GL, too. It is an advanced programming language, with a hybrid object-oriented, procedural and thread programming model. It can directly use Java code.

UNIX shells have a 4GL flavor. They are legitimate programming languages and provide commands for tasks common to all system users. JudoScript serves a similar purpose for Java as shells do for UNIX, except Java and JudoScript go beyond the basics. They can use the latest computing trends, extend their reaches into application areas and run on multiple platforms.

______________________

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Re: JudoScript: Scripting for Java and Beyond

Anonymous's picture

Congratulations for this great language!

Re: JudoScript: Scripting for Java and Beyond

Anonymous's picture

First of all, when the JudoScript language was announced on comp.lang.python.announce in late March this year, I thought it was an April Fools' Joke, especially with that "4GL" stuff (like the sendmail example).

Secondly, I don't think that the author justifies his statement that languages such as Jython "...are not good enough to use Java's rich functionality." Having actually used Jython for real-world stuff, I know I'd prefer to use a well-known, well-understood and widely-supported language such as Python whether or not it fits JudoScript's author's ideological criteria.

Re: JudoScript: Scripting for Java and Beyond

Anonymous's picture

I agree.

The effort to learn yet another new syntax for essentially doing the same job far outweights its benefits.

The JDBC stuff looks good though...

Re: JudoScript: Scripting for Java and Beyond

Anonymous's picture

<blockquote>Java is a so-called system language, with low-level, fine-granularity APIs and language constructs that enforce good software engineering. But these elements become obstacles in our situations. On a related note, coding in Java requires expertise that is at times not available or desirable.</blockquote>

As someone who has embedded JavaScript support into several Java applications, I must say that your goals while commendable would seem to tail your own notation of the failing of Java. Im not sure a language with so many solution based constructs that must be learned is going to dent that relevant expertise or ease of approachability problem. Like it or not, JavaScript is everywhere, and even the average Graphic Designer understands some fundamentails. Giving users a simple, fascade object written in Java passed through to the JavaScript interpreter seems to me to be much more effective than a whole new language to teach every designer, sysadmin and integrator in the world.

White Paper
Linux Management with Red Hat Satellite: Measuring Business Impact and ROI

Linux has become a key foundation for supporting today's rapidly growing IT environments. Linux is being used to deploy business applications and databases, trading on its reputation as a low-cost operating environment. For many IT organizations, Linux is a mainstay for deploying Web servers and has evolved from handling basic file, print, and utility workloads to running mission-critical applications and databases, physically, virtually, and in the cloud. As Linux grows in importance in terms of value to the business, managing Linux environments to high standards of service quality — availability, security, and performance — becomes an essential requirement for business success.

Learn More

Sponsored by Red Hat

White Paper
Private PaaS for the Agile Enterprise

If you already use virtualized infrastructure, you are well on your way to leveraging the power of the cloud. Virtualization offers the promise of limitless resources, but how do you manage that scalability when your DevOps team doesn’t scale? In today’s hypercompetitive markets, fast results can make a difference between leading the pack vs. obsolescence. Organizations need more benefits from cloud computing than just raw resources. They need agility, flexibility, convenience, ROI, and control.

Stackato private Platform-as-a-Service technology from ActiveState extends your private cloud infrastructure by creating a private PaaS to provide on-demand availability, flexibility, control, and ultimately, faster time-to-market for your enterprise.

Learn More

Sponsored by ActiveState