Beginner's JavaScript

Java without all the tedious programming? Not quite.

Summary
JavaScript provides the means to perform useful, simple tasks to improve the style of your Web site.

If you have seen Java in action on the web, but are afraid of trying to learn a programming language this complex, you should consider JavaScript. Sometimes reading different sources of information about something you don't understand will surprise you and start sinking in....keep reading.

Decaffeinated Java?
JavaScript is not just a decaffeinated version of Java. JavaScript is quite separate from direct Java applets and applications.

It is, primarily, a solution for Client-side APIs in Netscape Navigator 2.0.

The push toward moving the application processing from an already weighted server to the local user's interface came with the improvements in end-user desktop technology, both in hardware and software.

Java-lite
Formerly known as Java-lite or Mocha internally, JavaScript takes away some of the tedium involved in writing heavy-duty Java applets to do simple calculations or browser control functions.

The most obvious difference between the two is that JavaScripts are immediately interpreted by the browser from the source code, whereas Java applets need to be precompiled into a class before actual use.

This means that the scripts may run slower; each line is interpreted separately, usually one keyword and parameter combination at a time, rather than having faster compiled and code that can be immediately executed by the Java runtime environment within the browser.

Although you have to give up some object-oriented features available in Java, you still have objects with their methods and variables providing the necessary utility.

You can define objects but not classes of objects. The difference between an object and a class, is the difference between a building and its architectural plan; once you have a building, you can use it until its end; but if you have the building's architectural plan, you can build other buildings just like it or make major modifications to it.

You also have to give up object inheritance. In the building analogy, with classes and inheritance you can effectively make modifications to the architectural plan to make a better building, or one more suitable for its use.

Classes and inheritance exist to facilitate and improve the functionality and reuse of objects. In short scripts, you probably will not reuse an object too often so it is not really necessary. JavaScript provides loose type declaration for the lazy.

Programmers in the classic C, Pascal, and even Java worlds are familiar with strong type declarations where you have to specify that a variable is a string, an integer, etc.

In JavaScript, similar to how it works in the Perl language, you simply use a variable as necessary and it is up to the programmer to remember not to suddenly change a string into an integer or boolean. This lenient factor is partially due to the fact that the designers do not expect users to write too intensively detailed a program. For run of the mill scripting, it is easier to live without strong type declarations.

True Java applets do not generally interact with the HTML of a Web page. Each applet is limited to a subarea of the page.

Although an applet can be made to communicate with several other applets on the same page, it cannot, change the text of the same HTML page in which it is located.

Now Javascript, was created solely to allow HTML writers to allow different HTML tags and elements to interact with each other. An input box in one HTML form can modify the HTML information inside another HTML page.

In truth, there are actually ways of controlling your browser from within Java applets. However, to do simple things like calculations within forms, changing other frames within the browser, etc., takes a substantial amount of coding for a simple task.

Javascript was made to allow HTML writers to implement such functionality without spending hours upon hours writing Java code.

Another important difference, is that you do not have the large set of class libraries that you can use with Java. This limits the scripts to simple alculations and event processing.

For example, you cannot start a separate network connection within JavaScript and download a new class over the network into your hierarchy to build upon your basic browser's ability dynamically over the network; this is something you can do with Java, on the other hand.



YOU WANT MORE? Go HERE

My brain hurts.........Bye! ;)

Or if you've had enough just hit your back button, this link is for my other page.
Go Back

1