Java is an extension language designed, in particular, for fast
execution and type safety. Type safety is reflected by being unable
to cast a Java
int into an object reference or to get at
private memory by corrupting Java bytecodes.
|Interpreted (not compiled) by client.||Compiled on server before execution on client.|
|Object-based. Code uses built-in, extensible objects, but no classes or inheritance.||Object-oriented. Applets consist of object classes with inheritance.|
|Code integrated with, and embedded in, HTML.||Applets distinct from HTML (accessed from HTML pages).|
|Variable data types not declared (loose typing).||Variable data types must be declared (strong typing).|
|Dynamic binding. Object references checked at run-time.||Static binding. Object references must exist at compile-time.|
|Secure. Cannot write to hard disk.||Secure. Cannot write to hard disk.|
A script author is not required to extend, instantiate, or know about classes. Instead, the author acquires finished components exposing high-level properties such as "visible" and "color", then gets and sets the properties to cause desired effects.
As an example, suppose you want to design an HTML page that contains some catalog text, a picture of a shirt available in several colors, a form for ordering the shirt, and a color selector tool that's visually integrated with the form. You could write a Java applet that draws the whole page, but you'd face complicated source encoding and forgo the simplicity of HTML page authoring.
A better route would use Java's strengths by implementing only the shirt viewer and color picker as applets, and using HTML for the framework and order form. A script that runs when a color is picked could set the shirt applet's color property to the picked color. With the availability of general-purpose components like a color picker or image viewer, a page author would not be required to learn or write Java. Components used by the script would be reusable by other scripts on pages throughout the catalog.