Image of Navigational Panel mapped to Home / Conetnts / Search Java and the Internet Scene

by Jim Karabatsos - GUI Computing

Image of Line Break

If you have been living on the peaks of the mountains in Tibet, it is just barely possible that you have not yet heard of Java. Java is a new programming language from Sun Microsystems, Inc. that has generated more interest than any other programming language in recent times.

While the current interest in Java relates to its use in Internet applications, its roots are actually in the development of embedded systems where manufacturers wanted the ability to change the microprocessor (or more often microcontroller) without sacrificing their investment in the controlling software. This is because, with the huge volumes involved, swapping to a microcontroller that is even a few cents cheaper can make a huge difference to the bottom line.

How did Java make the leap from embedded systems to the Internet? Well it turns out that there are a lot of similarities between the two.

Embedded systems are typically quite small, both in terms of CPU grunt and available memory, so it is important that software for them be compact. Compact executables are very important for the Internet too, the reason for this being that large executables take too long to transfer over the communications links. Embedded system's CPUs come in a variety of flavours, each with its own unique instruction set. If software is to be portable across different microcontrollers, then it needs some sort of abstraction from the hardware.

The computers on the Internet are also quite diverse, encompassing (amongst others) Windows, Macintosh, and umpteen flavours of Unix, so any programming environment that wants to target all of these needs a similar abstraction layer. Microcontrollers are typically programmed by using a masked ROM on the chip. They are therefore programmed in huge batches to achieve economies of scale. In this environment programming errors are very costly indeed - so a good programming language needs to provide as much support as possible for writing good code, and for testing and validating the correctness of that code. Programs on the Internet are distributed widely and often without any good trail to find them again. Any errors will tend to linger on in older versions and it is very hard to find them and fix them.

Java is based on C++, so there will be some learning required for programmers who do not have a background in this language. However it is also significantly different from C++ and it may be easier for a non-C++ programmer to learn, because there is less unlearning to do. It is object-oriented, and contains a significant class library to get you started and to encapsulate an abstract network and GUI layer that is portable across different operating systems.

Java is compiled, but not to Intel machine code. This would not be of much use on an Apple Mac. Instead the Java compiler compiles the program to "byte codes", which are the op-codes for a virtual machine optimised for running Java applications. Each platform that supports Java needs to provide a run-time interpreter that executes these byte-codes (as well as native implementations of some of the classes which implement the native GUI and network objects on that platform).

Java is considered a "secure" programming environment. The Java byte-code program is interpreted and this means that dubious code can be disallowed. For example, when a Java program is downloaded over the Internet into a Java-enabled browser, it will normally be prohibited from accessing the local machine (it cannot read or write files, call any DLL functions, or access any memory outside its own variables) or the network (it can only connect back to the machine from which it was loaded, preventing snooping on the local network). Just about all it can do is draw inside its own window, interact with the user, and access files back on the machine it came from. This is obviously an important factor with the Internet because you really don't know what is going to be pulled into your browser next. Java programs can be compiled into applets, which are essentially controls. Java-enabled browsers then support programming these objects using JavaScript, which is essentially Java embedded in the HTML page. JavaScript statements can set properties, invoke methods, and respond to events from Java applets.

Java has been licensed by Microsoft but it has not yet been implemented in any of their products. If you want to take a look at Java, point Netscape at http://java.sun.com and go from there. (You will need Netscape to see Java in action.) There is a link from there to download the Java Development Kit, which will let you get a taste for the language.

One question that comes up time and again with Java is how is it ever going to succeed if it is free? While I have no inside information, it seems to me that Java is great advertising for Sun computers. My guess is that they are banking on the assumption that applications and Web sites employing Java applets will "naturally" be housed on Sun servers. Whether this works or not remains to be seen; certainly Java has raised Sun's profile in the minds of developers.

Java's main competition at this stage is Microsoft's VB-Script and ActiveX technology. In case you are wondering, ActiveX is a light-weight version of Microsoft's OLE controls. Unlike OCXs which need to support a host of interfaces and therefore have a minimum executable footprint of around 80 KB, ActiveX controls need just two abilities: the ability to self-register, and support for Iunknown - the prototypical OLE interface.

Essentially, Microsoft is saying that ActiveX controls are free to define and publish whatever interfaces they need to get the job done, and it is up to the host program and the ActiveX control to define how they communicate. There are some recommended interfaces for both the host program and the ActiveX control, but both are free to implement as much or as little of this as they need.

VB-Script is a light-weight version of VB, which Microsoft will license to third parties for inclusion in their browsers. The idea is that you can embed VB-Script code in your HTML pages, and that code may reference ActiveX controls. The browser checks whether the control is already present (and registered) on the system and whether it is the latest version; if not, it will download a copy over the network and load it so it can register itself. The VB-Script code can then set properties, invoke methods, and handle events generated by the control.

While VB-Script will appeal to VB programmers, VB4 does not allow you to create ActiveX controls. BASIC is very much limited to using ActiveX controls written in C++, at least for the time being.

The security implications of ActiveX controls are still unclear. Being compiled to Intel op-codes, you have no real way of knowing what any particular control may do. Microsoft is suggesting some sort of registry of "safe" controls and some sort of digital authentication certificate. Certainly these issues need to be addressed before ActiveX usage on the Internet becomes a realistic alternative. Of course, one may speculate that Microsoft is actually targeting ActiveX usage at the Intranets that everyone is talking about, where the controls can be verified by the system administrators.

To find out more about VB-Script, point your browser at: http://www.microsoft.com/intdev/sdk/ and download the preview of Internet Explorer 3 and the ActiveX tools. Also recently released is a new ActiveX control, called the PowerPoint Animation Player and Publisher. This can be found at : http://www.microsoft.com/mspowerpoint/

All in all, the Internet programming scene is really hotting up. My feeling is that the potential of the global WAN made possible by the Internet has not even had its surface scratched yet, and the amount of change we will see in this arena will be huge. It is impossible to call the winners yet; it may well be that the winners do not yet exist. As developers, we need to keep abreast with developments in these areas.


Written by: Jim Karabatsos
April 96

Image of Arrow linked to Next Article
Image of Line Break
[HOME] [TABLE OF CONTENTS] [SEARCH]