JudoScript.COM Design principles of Judo the sport and the language
HomeJudo LanguageJuSP PlatformJamaica Language 
Judo ReferenceJuSP ReferenceWiki/WeblogTutorials/PresentationsDownloadsGoodiesFeedback  
 
 








General Language Questions

  1. What is the difference between Judo and other scripting languages? What is the compelling hook over others?
  2. How does Judo compare to J/Python?
  3. Is Judo hard to learn? Do I have to know Java?
  4. Is it hard to learn Judo's application features?
  5. What is the licensing term of Judo?
  6. When NOT to use Judo?
  7. Why the name Judo?
  8. What are Judo's shortcomings?
  9. What about Judo's Performance?
  10. Can you list some facts about Judo?
  11. Why you created Judo?
  12. Is Judo embeddable in Java software?
  13. How to use threads in Judo? Can I use Java thread objects?
  14. Can I script Java classes of the Judo engine?
  15. What is native support in Judo? What is a non-native support then?

Judo Usage Questions

  1. Are Judo's JDBC scripts cross-RDBMS's?
  2. How to specify a (non-built-in) JDBC driver class?
  3. How to copy multiple directories into a single ZIP file?
  4. How to serialize executable runs?
  5. Can I use my Java classes? Do I have to specify my long Java class names everytime?
  6. Can I use a Java interface? How?
  7. Can I extend and use a Java abstract class and interfaces? How?
  8. How to use Java static members and methods?
  9. What is the easiest way to read a text file, line-by-line?
  10. Is Judo good for templates?


1. What is the difference between Judo and other scripting languages? What is the compelling hook over others?

Judo is a potent programming and Java scripting language. What differs it from others is, Judo has many built-in language constructs for popular application areas, making their uses intuitive, natural and elegant. See the definition of scripting to learn why Judo is so different than programming languages that you are so familiar with. With such a 3GL-4GL language design, Judo puts extraordinary emphasis on ease-of-use as well as ease-of-program.

Take Python, a perfect example of traditional programming languages, especially so-called scripting languages. It employs a small set of core language syntax and constructs, including a library mechanism that allows users to extend functionalities of the language. A library is a collection of APIs that application software are built upon. To ensure maximum reusablity and applicability, APIs are generally low-level and detailed relative to the problem you are trying to solve. Such is the 3GL approach.

If 4GL is a new term to you, think about Unix shells. Unix shells are legitimate programming languages, and has special commands that pertain to topics common to all Unix system users, such as file system manipulation, process control, system configuration, etc. For instance, you use 'cp' command to copy files, instead of coding a job-control-language (with APIs) to do the same. Judo is the first and only Java-based scripting language that does all the above but extends its reach into many of today's popular application fields, such as JDBC scritping, XML scripting, SGML scraping, COM scripting, internet scripting, GUI scripting, etc. This is the compelling hook over most other scripting languages.

 [back to top]
 
2. How does Judo compare to J/Python?

Jython, BeanShell, Rhino, Judo and other Java-based scripting languages are all general-purpose programming languages and are capable of scripting Java, despite their syntax differences. On top of that, Judo also provides many application level scripting features at the language level, so Judo supports object-level, OS-level and application-level scripting. See the definition of scripting for a more meaningful comparison.

 [back to top]
 
3. Is Judo hard to learn? Do I have to know Java?

The core Judo language uses syntax and programming model similar to JavaScript. Variables are not typed and no declaration is needed. Like any modern languages, it adopts an object-oriented language design, every kind of value has a set of operations (methods). Judo is well documented with ample examples and technical articles.

You will need to know how to run Java software on your platform (Unix, Windows, ...) in order to run Judo programs. For instance, if you want to use JDBC scripting to handle data in an Oracle database, you will need to know how to add Oracle's JDBC driver into the class path. Judo is a powerful scripting langauge itself and has many powerful functionality to do most work.

One of Judo's key features is Java scripting. This is essentially designed for Java programmers, but some times non-Java programmers may have to use Java as well. An example is the Java byte array used in binary file read and write.

The recommended way to extend Judo is write Java code, although you can definitely create Judo functions and classes to do the same. Writing Java extension library is good because the same code can be shared by Judo and Java programs; they are typically more performant and robust thanks to Java's strong-typedness.

In short, Java knowledge is not required for end users, but is extremely important to take full advantage of Judo.

 [back to top]
 
4. Is it hard to learn Judo's application features?

How hard can it be to learn these?

mail::send
    from: 'feedback@judoscript.com'
      to: 'A@some-site.cum'
      cc: 'A@other-site.cum'
 subject: 'The software. Thank you!'
  attach: 'judo.jar.zip, src.jar'
    body: [[*
          Dear Mr. A,

          Thank you very much for your interest in this software.
          Attached is the software and source code.
          Please visit www.judoscript.com for the latest news
          and information. Thank you!

          Sincerely,
          Judo
          *]]
htmlBody: [[*
          <html><body>
          <p>Dear Mr. A,
          <p>Thank you very much for your interest in <i>this software</i>.
          Attached is the software and source code.</p>
          <p>Please visit <a href=www.judoscript.com>www.judoscript.com</a>
          for the latest news and information. Thank you!</p>
          <p>Sincerely,</p>
          <p>Judo</p>
          </body></html>
          *]]
;

Compare this to coding with javax.mail.* packages, especially if you don't know how to program javax.mail.* yet.

do 'http://www.yahoo.com' as sgml
{
<a>:    if ($_.href) println $_.href;
<img>:  println $_.src; // $_ represents the current tag.
}

This program prints out the URLs in <a> and <img> tags of an HTML page. This is similar to XML SAX programming but is significantly more concise and elegant. Judo supports XML SAX programming exactly the same way.

Judo application features are designed based on the needs of the topic; they are natural and intuitive to the problem domain, and are easy to use and learn; this is especially true when compared to their Java counterpart.

 [back to top]
 
5. What is the licensing term of Judo?

LGPL. You are essentially free to do anything with the software and its source code.

 [back to top]
 
6. When NOT to use Judo?

Scripting languages are great for doing things quickly, or tasks that are simple, straightforward and take frequently updates. Scripting languages are not designed for building big software; that is the job of system languages such as C, C++ or Java. If a big software project is coded in a scripting language, you can pretty much assume it is still in prototype stage. Why? because system languages have mechanisms that enable compilers enforce stringent rules so as to prevent many potential problems; compilers can also optimize the final product to gain more performance.

Judo, being a pure scripting language, is no exception to this rule.

 [back to top]
 
7. Why the name Judo?

Better names are already taken. The name is chosen because a) it sounds ok, and b) it starts with "J".

 [back to top]
 
8. What are Judo's shortcomings?

Judo is totally based on Sun's Java. Java implements the common denominator of all supported platforms, and is not great to deal with popular platform features such as 'chmod' on Unix. Judo tries hard to provide features on popular platforms by working around Java's problems (for instance, 'chmod' and 'chown' are implemented for Unix platforms, environment variables are handled, etc.), but there must be situations where platform native code (through JNI) is needed. The classic example is COM scripting. This does not necessarily break the "100% Pure Java"-ness of Judo, because such features are declared to be optional. By the way, Judo never bothered to pass the "100% Pure Java" test.

 [back to top]
 
9. What about Judo's Performance?
Judo's performance is surprisingly good, most probably thanks to the JVM JIT compilers. The start-up is not that fast; on Windows 2000 and (slower) Linux machines, small to medium size scripts take 2 to 4 seconds to begin executing.
 [back to top]
 
10. Can you list some facts about Judo?
  1. Designed ground-up just for Java.
  2. Pure Java.
  3. Open-source freeware under LGPL; can be use for commercial or any purposes.
  4. Is a 3GL and a 4GL.
  5. Hybrid procedural and object-oriented language.
  6. Basic data types include integer, floating-point number, date/time and string; each with large number of operations (methods).
  7. Advanced data structures:
    • array and linked list; flexible sorting and filtering
    • struct and ordered map; flexible sorting and filtering
    • stack and queue
    • tree
    • table data; in-memory relational database features
  8. Support advanced programming techniques:
    • user-defined classes and inheritance
    • exception handling and resume statement
    • thread programming similar to functions
    • user-defined functions; can take variable number of parameters, and parameters can have default values
    • function variables and lambda functions
    • dynamic evaluation of code and files
    • flexible iterations of arrays and linked lists
  9. Java-like statements and expressions.
  10. Syntactic sugar, including various comment formats for Unix auto-run and code disabling.
  11. Seamless uses of Java classes, objects and arrays.
  12. Java collection classes share same syntax as Judo container data structures.
  13. Java static methods can be aliased to become Judo functions.
  14. Explicit JNDI support to facilitate RMI and EJB scripting.
  15. Is extensible by Java classes or by Judo libraries or a mixture of both. Library code can be moved from Judo into Java (later) without changing the interface.
  16. All existing Java software tool packages, commercial or free, can be used directly in Judo.
  17. Sophisticated JDBC scripting and database manipulation features.
  18. Many built-in application features; some with special syntax (hence 4GL), others are system functions. An incomplete list includes:
    • JDBC scripting
    • XML scripting
    • HTML/SGML scraping
    • Microsoft COM scripting
    • HTTP/HTTPS client and server
    • Schedule jobs with HTTP monitors
    • Flexible file copying and archiving between file systems, JAR, ZIP and TAR files
    • Consistent I/O model for local files, files within JAR/ZIP/TAR archives, gzipped files, internet resources and string data sources
    • FTP, SSH, SCP, networking services, Windows registry editing, Unix syslog
    • Encryption
    • Send mail
    • Versatile executable running
    • Java GUI creation
    • Text and data processing features
  19. Embeddable by Java software either by Bean-Scripting-Framework or via its own engine.
  20. Is interpreted. Precompilation is planned.
  21. Rich documentation for reference, tutorials and examples.
 [back to top]
 
11. Why you created Judo?

To use Java for everything, not just programming. Specifically,

  1. to scripting Java,
  2. to scripting many tasks extremely easily, and
  3. to do these within an easy and powerful programming environment.

 [back to top]
 
12. Is Judo embeddable in Java software?

Yes, in one of the two ways: its engine API and its BSF support.

 [back to top]
 
13. How to use threads in Judo? Can I use Java thread objects?

Judo supports an easier thread programming model. Since you can use any Java objects in Judo programs, nothing prevents you from using java.lang.Thread objects, but this is strongly discouraged.

 [back to top]
 
14. Can I script Java classes of the Judo engine?
This is prohibited (by the language engine) except for the com.judoscript.util.* package and its sub-packages. And their uses are not documented or guaranteed.
 [back to top]
 
15. What is native support in Judo? What is a non-native support then?

A native support in Judo generally means specific syntax support in Judo, sometimes it is just a built-in function. A "non-native" support for a Java software or feature basically means you have to program using the Java APIs.

 [back to top]
 
16. Are Judo's JDBC scripts cross-RDBMS's?

This question is equivalent to "Is Java's JDBC cross-RDBMS's", because Judo does not provide anything beyond what JDBC drivers provide. In other words, Judo passes SQL and other parameters via JDBC API to the specific JDBC driver being used without further filtering and interpretation.

 [back to top]
 
17. How to specify a (non-built-in) JDBC driver class?

You can use the Java way of Class.forName(jdbcDriverClassName), or specify it as an attribute of "driver" in the database connection statement.

 [back to top]
 
18. How to copy multiple directories into a single ZIP file?

Use createJar(), createZip() or createTar() system functions to create a ZIP or tar archive, then use the copy command for each directory into that archive before finally call the close() method of the archive object to complete.

 [back to top]
 
19. How to serialize executable runs?

By specifying a variable to receive the return value of the executable, you can effectively serialize multiple executable runs.

 [back to top]
 
20. Can I use my Java classes? Do I have to specify my long Java class names everytime?

Any Java classes can be used in Judo. Use the Java package name shortcut mechanism to make it easier to use if your Java class names have long package names.

 [back to top]
 
21. Can I use a Java interface? How?

See here.

 [back to top]
 
22. Can I extend and use a Java abstract class and interfaces? How?

See here.

 [back to top]
 
23. How to use Java static members and methods?

Use :: between the Java class name and the static method or member name to use them. Or, If a static Java method is repeatedly used, can use the static Java method alias mechanism to make them look like regular Judo functions.

 [back to top]
 
24. What is the easiest way to read a text file, line-by-line?

Use the do ... as lines {} statement.

 [back to top]
 
25. Is Judo good for templates?
You have two ways to create a templating system in Judo,
  1. For simple text replacement, use the do ... as lines {} statement.
  2. You can define your own SGML format with tags, case-sensitively or insensitively, and eaily create processing software with the do ... as sgml {} statement.
Another convenience is the Local Data mechanism, that you can attach a template right at the end of the script.



Copyright © 2001-2005 JudoScript.COM. All Rights Reserved.