Welcome!

PowerBuilder Authors: Dan Joe Barry, Carmen Gonzalez, Ian Thain, Yakov Werde, Paul Slater

Related Topics: PowerBuilder

PowerBuilder: Article

Is EAServer a Language-Neutral Platform?

Is EAServer a Language-Neutral Platform?

There's a variety of programming languages worth taking a look at, many of which can be used in your EAServer and client/server projects.

This might sound like a silly question to you: Do you know which languages EAServer supports out of the box? (As you'll see a bit later, I write out of the box.)

  • PowerBuilder (Version 7, 8, and 9)
  • Java/J2EE
  • C/C++ (CORBA)
  • PowerDynamo
At first glance we would answer the question with a definite no. EAServer is not language-neutral. Should we finish this article now and give up? I say we should look at what language-neutral means. And as EAServer supports Java, we'll take a deeper look at it, but is Java language-neutral? This may seem like a silly question. Java is a language. Isn't it? Maybe. And maybe not.

It depends on what you mean by "Java." Some of us think of Java as being a specific programming language with an associated syntax and a set of language features (such as automatic garbage collection). Sun, however, has traditionally used the term "Java" to mean both the language and the platform (including the extensive Java platform API). In other words, Java is both what you program with and what you program to.

You might argue that a platform and a language are closely related. However, of the two forerunner technologies to the J2EE part of the Java platform, CORBA and the Microsoft Transaction Server, both took considerable pains to distance themselves from any particular language. Microsoft's .NET platform, the only serious competitor to the Java platform (besides PowerBuilder), has also been very careful to maintain language neutrality.

There are good reasons for separating platforms from languages. Platforms change slowly; you still have some applications running under NT 4.0, haven't you? Languages change frequently. Yesterday it was C/S with PowerBuilder; today it's distributed computing with EAServer, PowerBuilder, and Java; and tomorrow, who knows? Platforms are generic, able to run a range of applications. Languages are specific, optimized for certain types of applications.

Another important reason for separating the language from the platform is the pragmatics of training new programmers. Most large companies have programmers with different language skills. Training a PowerBuilder programmer to work with the Java platform will be much easier if he or she also doesn't have to learn the Java programming language.

If we accept the argument that language and platform should be independent of each other, it becomes a reasonable question as to how well this has been accomplished in Java. Is the Java platform truly nonpartisan when it comes to language?

Before we can answer this question, we need a definition of a "language-neutral platform."

A language-neutral platform is one that truly doesn't care which language you use. It allows you to choose languages based on the pragmatics of the situation, not the predilection of the platform. It allows you, for example, to purchase a class library written in one language and adapt it to the language of your choice. It allows you to have different programmers working on the same project in different languages.

The platform must support the development of a class library in one language and invoke methods on it from another. The following list is a minimum set of requirements that enables a programming platform to be truly language-neutral.

  • Cross-language polymorphic method resolution allows base classes in one language to have methods overridden in other languages.
  • The platform must support a language-neutral typing system, allowing parameters to be freely passed from methods written in one language to methods written in another.
  • The platform must support cross-language exception handling, allowing exceptions raised in a method in one language to be caught and processed in a calling method written in another language.
  • The platform must define an API that can be used from any supported language.
  • It must have a portable binary format for deliverable software components, i.e., standard bytecodes plus a standard component file format.
  • A static structural data model that includes dynamic dependency resolution (import and inheritance) at load time.
  • A dynamic (runtime) method resolution mechanism that supports method polymorphism and argument binding.
  • A basic, structured (stack-oriented) exception model that includes raising and catching exceptions, and finalization.

    If the Java platform is to be language neutral, the key would have to be Java bytecode (JBC). The Java-language architecture requires that Java source code be translated to JBC before being compiled or interpreted. In theory, any language that can translate to JBC should be usable within the Java platform. This brings us one step forward. If we take any language and let it produce JBC, we have what we want.

    Programming Languages for the Java Virtual Machine
    As you can see on http://grunge.cs.tu-berlin.de/~tolk/vmlanguages.html, there are currently about 160 different systems. Be careful since this list is a mix of both experimental, research-oriented implementations and commercial ones. However, this list contains only languages in which the source code of a program executed in the Java VM has a syntax that's different from Java's.

    The following is a partial list of programming languages, the language's port, and a brief description for the Java Virtual Machine.

    Ada
    JGNAT Ada 95

    The JGNAT system offers a complete Ada 95 development environment for the Java platform. JGNAT is made up of a compiler that generates Java bytecode that's compatible with Java Virtual Machines conforming to Sun's standard (JDK 1.1 and above), and a set of tools to aid in developing Ada programs for the Java platform.

    Assemblers
    Javaa

    The Java Bytecode Assembler is a program that converts code written in "Java Assembly Language" into a valid Java .class file.

    Jasmin
    Jasmin is a Java Assembler Interface. It takes ASCII descriptions for Java classes that are written in a simple assembler-like syntax and use the Java Virtual Machine instruction set. It converts them into binary Java class files suitable for loading into a Java interpreter.

    Jas
    Jas is a Java bytecode assembler. Java bytecode can be generated through a script that drives the assembler package or directly through the assembler package from Java. The assembler package is very simple - it doesn't attempt to validate or optimize bytecode.

    Basic
    Convert

    With Convert 1.1 you can use your Visual Basic expertise to create high-powered, sophisticated Java applets and applications. Convert 1.1 is a GUI converter; your VB screens are translated directly into Java source code.

    JBasic
    JBasic is an embeddable BASIC interpreter written entirely in Java. It's designed for scripting JavaBeans at runtime. You can embed JBasic in any Java application, applet, or bean using the JBasic Runtime Engine. (Note: I've received an e-mail from Mike Lehman that refers to some legal information that this is not the first embeddable Basic - if you care about such important notionsŠ.)

    JavaBasic This is a command-line interpreter that loosely uses the BASIC command set.

    COCOA
    The Java BASIC Interpreter is a simple BASIC interpreter written in Java. It's a primitive BASIC, uses line numbers, and implements most of BASIC-80.

    TRS-80 Model 1 BASIC Interpreter
    This applet is an interpreter for TRS-80 Model 1 Level 2 BASIC. Note that it is a BASIC interpreter, not a TRS-80 emulator; thus, the hardware-specific commands (PEEK, POKE, etc.) don't work.

    Applet Designer
    A Visual Basic add-in, it converts new or existing VB applications into Java applets.

    COBOL
    PERCobol Enterprise Edition

    This is a robust COBOL development solution that enables COBOL programs to execute on the Java Virtual Machine. PERCobol is a fully ANSI 1985 X3.23b standard-compliant COBOL compiler that generates Java source code. The resulting code can then be compiled using any JDK 1.1+ compliant Java compiler and will run on any JDK 1.1+ implementation of the JVM as either an applet or application, depending on how the program is invoked (applets are subject to applet security restrictions).

    Eiffel
    J-Eiffel

    An Eiffel-to-Java compiler is an Eiffel compiler with JVM bytecode generation.

    Project Bruce
    Translating from Eiffel to Java, this was a collaborative project between the Microsoft Research Institute at Macquarie University in Sydney, Australia, and Interactive Software Engineering (ISE), and was aimed at developing an Eiffel-to-Java compiler.

    Forth
    myForth

    A basic Forth interpreter written in Java, Forth programs can be read from Java applet parameters.

    DELTA Forth
    A new Forth dialect that's intended to bring the Forth programming language to the Java universe. Unlike Forth, DELTA Forth is a compiled language. This means that the source code is turned into a special format that's used to execute the program.

    Lisp
    SISC

    An extensible Java-based interpreter of the algorithmic language Scheme, SISC is a complete implementation of the language. The entire R5RS Scheme standard is supported. SISC can also interface with Java through a bridge module called J2S.

    Lisp
    This is a small Lisp implementation in Java.

    PS3I
    The Persistent Server-Side Scheme Interpreter is almost an R4RS-compliant scheme implementation written in Java. It is multiuser, multithreaded, and aimed to run on (Web-)servers (as servlets).

    Logo
    AJLogo

    AJLogo is an implementation of Logo written in Java with about 400 primitives.

    Turtle Tracks
    A modern Logo interpreter and runtime environment written entirely in Java, it's not a direct port of an existing interpreter, but is written from the ground up specifically for Java, and designed to take advantage of the strengths of Java as a platform. It supports numerous advanced features such as multithreading and networking. It's a complete implementation of true Logo, supporting the same basic language syntax and semantics and most of the same primitives as other common Logo implementations, such as Berkeley Logo. It also supports plug-in primitive sets and can be integrated with outside Java code as a scripting language.

    Smalltalk
    SmalltalkJVM

    This compiler allows Smalltalk to run on any JVM. The compiler currently produces 100% Java class files that are fully compatible with the Sun JVM specification. This allows Smalltalk and Java code to interact seamlessly and allows Smalltalk programs to run anywhere Java runs.

    Talks2
    A full Smalltalk development environment, it runs on top of the Java Virtual Machine. It includes a ClassBrowser, Workspace, Transcript, and all the things you know from a Smalltalk Development Environment. Talks2 translates Smalltalk to Java, and also uses the Java GUI and IO to run in any regular Java environment.

    Bistro
    A new programming language that integrates features of Smalltalk and Java, Bistro is a variation of Smalltalk that runs on top of any JVM that conforms to Sun's Java specifications. Bistro offers Smalltalk developers a way to reuse the models they built with Smalltalk. Bistro provides mechanisms for translating Smalltalk model code into Java, so that models originally built with Smalltalk may be deployed on and execute in a Java environment.

    Scripting
    JRuby

    JRuby is the effort to re-create the Ruby interpreter in Java. Currently, the interpreter is written in C. The Java version will be tightly integrated with Java to allow you to script any Java class and to embed the interpreter into any Java application.

    JPython
    JPython is an implementation of the object-oriented scripting language Python, and is seamlessly integrated with the Java platform. It features high-level built-in data types, dynamic typing, packages, classes, and interactive compilation to Java bytecodes.

    Jython
    Jython is an implementation of Python, the high-level, dynamic, object-oriented language written in 100% Pure Java, and is seamlessly integrated with the Java platform. Thus it allows you to run Python on any Java platform. Jython is the successor to JPython.

    Tcl
    Jacl

    Pronounced "Jackal," Jacl is a Tcl interpreter written in Java. You can use it for Java the same way Tcl is used for C - a scripting language to glue together modules written in a low-level language.

    Jython with EAServer
    I'd like to focus briefly on Jython as it's freely available for both commercial and non-commercial use and is distributed with source code. Jython complements Java and is especially suited for the following tasks:

  • Embedded scripting: Java programmers can add the Jython libraries to their system to allow end users to write simple or complicated scripts that add functionality to the application.
  • Interactive experimentation: Jython provides an interactive interpreter that can be used to interact with Java packages or with running Java applications. This allows programmers to experiment and debug any Java system using Jython.
  • Rapid application development: Python programs are typically 2-10 times shorter than the equivalent Java program. This translates directly to increased programmer productivity. The seamless interaction between Python and Java allows developers to freely mix the two languages during development and when shipping products.

    Conclusion
    As we saw, there are a lot of interesting languages out there worth looking at. Many of them can be used in your own client/server or EAServer projects. I agree that some of them are still "under development," but a lot are worth looking at. This article should show you that the Sybase slogan is true - "Everything works better, when everything works together" - we just have to open our minds and our eyes.

    Software Used

  • EAServer 4.1.3 - free evaluation version: www.sybase.com
  • Jython 2.1 - free version: www.jython.org/download.html

    Resource

  • Programming Languages for the Java Virtual Machine: http://grunge.cs.tu-berlin.de/~tolk/vmlanguages.html
  • More Stories By Berndt Hamboeck

    Berndt Hamboeck is a senior consultant for BHITCON (www.bhitcon.net). He's a CSI, SCAPC8, EASAC, SCJP2, and started his Sybase development using PB5. You can reach him under admin@bhitcon.net.

    Comments (0)

    Share your thoughts on this story.

    Add your comment
    You must be signed in to add a comment. Sign-in | Register

    In accordance with our Comment Policy, we encourage comments that are on topic, relevant and to-the-point. We will remove comments that include profanity, personal attacks, racial slurs, threats of violence, or other inappropriate material that violates our Terms and Conditions, and will block users who make repeated violations. We ask all readers to expect diversity of opinion and to treat one another with dignity and respect.