AdaIC News Fall 1996


     New Ada Markets
Ada-Java Ada, Java, & Reuse
-- A Natural Match


| New Markets -- ready made for Ada |
| Why Java? | Remember p-code? |
| A need and the opportunity to meet it |
| Conserving Bandwidth | Learning Java? |


"Java really exists only in the Web, and C++ only
off the Web... Ada lets you bridge that gap."

S. Tucker Taft, Chief Scientist, Intermetrics, Inc.

New Markets -- ready made for Ada

If you've been wondering why people on the World Wide Web are talking so much about Sun Microsystems' new programming language, Java, then perhaps this article will fill in some of the blanks.

Of course, if you're already familiar with the whys and wherefores, and you write in Ada, you may be wondering how you can tap into the growing market the Java programming language is opening up. For you, the bottom line is simple: You'll soon be able to write in Ada for the Java market.

But a larger benefit is also possible: You may be able to reuse Ada code you've already written; and code you write for the Web may be reusable outside it. According to S. Tucker Taft, Chief Scientist at Intermetrics, Inc., "Java really exists only in the Web, and C++ only off the Web, whereas Ada lets you bridge that gap."

(To find out more about obtaining bridge-building tools, see the inset to the right, "ATIP-P Supports Ada Java Compiler".) Ø

Why Java?

"Java" has the potential to become a lot more than the buzzword of the day. A programming language that was wending its way through Sun Microsystems, Inc., Java has turned out to be ideally suited to adding yet new bells and whistles to the World Wide Web.

Moving beyond the buzzword stage, however, two questions arise: What does it do that other languages can't? And why should Ada engineers take notice?

The answers are that it will let the Web use the processing power of the user's own computer, and that Ada programmers interested in reaching that market may already have written some of the code needed to do so. Ø

Remember p-code?

Java's approach may sound familiar. In most languages, you write the code, you send it through a compiler, and eventually the compiler produces the binary code that will execute on the intended hardware. If you want to run the program on another target, and if your code is portable, you recompile on another compiler.

A Java compiler, however, doesn't produce the executable. Instead, it produces bytecode, or Java-code (J-code); the bytecode is intended for the Java "virtual machine". To perform the desired task, a Web browser such as Sun's HotJava must execute the bytecode. Other browsers, such as Netscape or Mosaic, can similarly incorporate the capability.

The approach may sound familiar -- it's a lot like the "pseudo-code" of UCSD Pascal of many years ago. In a world in which not even disk formats were standardized, p-code could be used as an intermediary step. With p-code compilers on the various end-user machines, your code could reach the widest possible market. When the market settled on fairly well-defined standards such MS-DOS and Macintosh, there was no need for that intermediary. In fact, it seemed a waste for user machines to spend the processing time needed to compile p-code. Now, however, the "waste" can provide a benefit -- a profit, not an expense. Ø

A need and the opportunity to meet it

The World Wide Web is experiencing major growth right now. As a display medium for text and graphics, it provides a Windows/Mac-like interface that beginners find simple and easy to use. Underlying that interface is the HyperText Markup Language (HTML). An HTML file is basically simple: an ordinary text file with formatting commands embedded between corner brackets. A Web browser on a Mac translates them into the appropriate code for a Mac, a browser on a PC or a workstation does likewise.

But users and developers want to take the Web further. For instance, there are enormous database resources that could be brought onto the Web -- but accessing them takes processing power. Right now, that processing has to take place on the Web host being accessed. Every time a user invokes a process, it has to run on that Web host. Increased demand for information will take up valuable time on Web hosts, and passing complex information takes up valuable bandwidth on the Internet itself.Ø

Java has the potential to make it easier to meet the need for information while conserving bandwidth.

Java bytecode isn't processed on the Web host -- it's processed at the end user's site. With Java, the Web can now tap into a virtually source of processing power. Java won't cure all the Web's growing pains, but it may ease some of them, and open up new opportunities at the same time. Ø

So, should software engineers rush to learn Java?

Well, perhaps -- unless they program in Ada! In which case, the Ada Java compiler (described in the inset) may be an even better idea. Ø



ATIP-P Supports Ada Java Compiler

| AppletMagic | A good match permits reuse |
| For More Information |

If Ada is to let you bridge the gap between the Web and non-Web worlds, the first tool you need is an Ada compiler that will produce Java code for Java applications (applets).

AppletMagic

The Ada Joint Program Office (AJPO) has provided initial assistance for production of "AppletMagic" -- developed by Intermetrics, Inc., and based on their AdaMagic compiler. A beta version is already completed, and available for downloading over the Web. An initial public release is expected by mid-to-late summer, in the $100-200 range, with added tools in the works thereafter.

At this writing, the integrated development environment is perhaps the most important work taking place. According to S. Tucker Taft, Chief Scientist at Intermetrics, the work taking place in spring had to do with the run-time system. "Since we're taking an existing frontend," he said, the beta version already "supports all the frontend features of Ada" such as generics and enumerated types. With porting the runtime system to Java, features such as tasking and protected objects will be coming in, hopefully before September.

Ada the Language for a Complex World Taft also said this is intended to be "a very open development environment, so you can add tools to it, basically by writing more applets in Java Ada or Java or whatever. You can just add them into the development environment in sort of the way Visual C++ works.... But this will be even more flexible, that is, you can add even more things -- a little more like emacs, if you're familiar with that."

(Assistance to the Ada Java compiler is part of the AJPO's Ada Technology Insertion Program-Partnership (ATIP-P), in which the DoD acts as a sort of venture capitalist to encourage development of products it needs. For more on ATIP-P, see "ATIP-P Makes Awards to Spur Development of Commercial Ada 95 Products", in this issue.) Ø

A good match permits reuse

"From my perspective, one of the most interesting things is that the two languages are completely interoperable. From Java, you can call anything written in Ada, and from Ada, you can call anything written in Java. There's no sort of 'additional effort' involved in calling between the two languages."

Although Java is syntactically an offshoot of C/C++, technical factors appear to preclude a C/C++ Java compiler. A translator might be used to take C/C++ source and give a starting point, but it would still need a fair amount of work to produce usable Java code.

Of course, it is straightforward for a C++ programmer to learn Java. But Taft pointed out that, "you can't actually reuse any C/C++ code. Whereas with Ada, I would imagine that you can actually reuse Ada code that you already have."

One of the advantages here is that "if you put an investment in building, let's say, some complicated applets with a fair amount of packages that you developed and so on, you can use that same code with a conventional Ada compiler and develop a standalone product that runs off the Web -- and recover some of that investment. You can move code in both directions."

"One of the directions we'd like to go is to make that even easier. One of the things that makes it not trivial is that a lot of the applet code will probably be using the graphical user interface libraries that come with Java. We have an Ada interface to that, but you need an Ada implementation for that in your native environment, whatever it might be. So one of the things we are thinking about is taking the Ada interface that exists for the AppletMagic Ada Java world and developing actual native implementations of it. Then you could really take the same code that you had running in the Web world and run it in the non-Web world and still have it work." Ø

For further information

For information on check out the following Web Sites:

Sun Microsystems Java http://java.sun.com
Intermetricshttp://www.inmet.com/javadir
AdaIC's Java Page http://archive.adaic.com/java

Ø



        Back                    Contents                    Next