Java versus JavaScript versus HTML Issues
|
Some Simple Motivating Examples
|
Language Features and Syntax
|
The Peculiar Object Model -- Functions Properties and Methods
|
Arrays in old and new JavaScript
|
Arguments of Functions
|
with and other object related syntax
|
The JavaScript built in Math String and Date Objects
|
The Navigator Objects -- Frames Windows Document Form
|
Event Handling including Function object
|
Cookies
|
User Objects and Examples including using JavaScript for frames
|
Historically JavaScript was called LiveScript and developed by Netscape with some of the same goals as Java but focussed on a "smaller world" -- manipulation of text and options connected with Netscape Clients
|
TEXT ............................................. COMPUTER Language
|
HTML --> JavaScript Java <--- C++
|
Now we can use it under some circumstances as an alternative to Java where the "rapid prototyping" of a fully scripted language is helpful
-
We expect somebody to develop a fully interpreted Java -- equivalently to extend JavaScript to support more built-in objects (e.g. networking, images)
-
JavaScript is "either" active text (HTML) or a focused language!
|
JavaScript can be thought of as Java with the AWT (Abstract Windowing Toolkit) replaced by Netscape Client
-
JavaScript is a domain specific Interpreter for "Web Document Domain"
-
e.g. Postscript is a domain specific Interpreter for text layout and MATLAB is an interpreter for matrix manipulation, Mathematica is domain specific for mathematics ......
|
Execute C code Instruction -- 1 clock cycle ( 10^8 per second)
|
Run a client side C subroutine -- can do upto 10^6 instructions in time (few milliseconds) that is significant for user
|
JavaVM Interpreter -- roughly 50 times slower than C
|
JavaVM Just in Time Compiler (effectively compile JavaVM in real time) -- roughly 2 to 8 times slower than C
|
Native Java Compiler -- same speed as C
|
Perl Interpreter (but does process whole program before interpreting) -- 500 times slower than C except in runtime
|
Tcl, JavaScript "true" Interpreters - 5000 times slower than C
-
Can still do 100-1000 instructions in time that users don't notice!
|
Contact Host via CGI script -- Server, Network and Client HTML page regeneration delay can be measured in seconds.
|