Forum Moderators: open
Here is the rant: Java IS NOT JavaScript. (Exactly the same that Perl is not Visual Basic - completely different)
Let's clear it up a bit:
1) JavaScript is generally used in a webpage and is a client-side scripting language.
2) Java is often used as a client side program. The language is different and much more powerful.
3) Java server-side is the same as Java but is used on a server in the same way as ASP/PHP (the resultant output of the program is sent to the client, not the program itself). These generally have the extension .jsp
Sorry for the rant, but when you are on the board which attracts some of the best webmasters in the world, they ought to know the difference between the technologies they use!
..they ought to know the difference between the technologies they use!
I'm pretty sure you didn't mean this, but that sentence could be taken to imply that regular contributors here don't know the difference. They are, of course, well aware.
It is true that we don't always jump to correct the misuse of the term. Personally, I'm more interested in a constructive ripping apart of someone's script than their terminology. They did at least make it to the right forum, so I'll leave the "'snot Java" to a BTW.
Interestingly (perhaps), we don't regularly point out that W3C DOM methods,like
getElementById, or arguably even standard browser interface methods such as setTimeout, are not Javascript. 1) JavaScript is generally used in a webpage and is a client-side scripting language.
This one has a chink in it. "generally a client-side scripting language" would have been better.
Although ASP is more commonly scripted in VBScript, Javascript can be, and is, often used. There's also Javascript's use in the Windows Scripting Host. Javascript (actually declared as Javascript, not JScript) is also used in the Windows Explorer to control the behaviour of opened folders.
2) Java is often used as a client side program. The language is different and much more powerful.
Yes...but one could be excused for considering Javascript as a scripting version of Java.
3) Java server-side is the same as Java but is used on a server in the same way as ASP/PHP (the resultant output of the program is sent to the client, not the program itself). These generally have the extension .jsp
Not that I have much JSP experience, but a little birdie told me that the Java used in JSP occasionally displays characteristics of of a scripting language. Again, ASP can be scripted in Javascript.
The plain fact is that people, not surprisingly, will always confuse the two at the start. We can gently point out the difference when there is a misunderstanding, and that's all. There is a permanent post about this in the library [webmasterworld.com ].
I'm not sure I follow you on the getElementById() and setTimeout(), however. The objects, in the one case, and OS functionality, in the other, are not JavaScript in origin, but the methods are part of the JS language, not assembler, or VBScript, or such. Arguably, it is relatively rare that JS operates on JS objects (other than variables); it's usually working its magic on HTML, or the DOM.
While there is surely a derivative similarity between JavaScript and Java, but there are some world-class (pun intended) differences, as well. Java (and C++) uses class-based inheritance; JavaScript uses prototype-based inheritance. Variables and their declarations are more strict in Java (and almost every other computer language) than JavaScript. Java has no global variables (okay, a public static by any other name), while (poorly-written) JavaScript programs are often rife with them. Also, while it might seem a trifle, it is not: Java demands the coherent use of the semi-colon to end statements. Sadly, to make JavaScript "easy", it was decided by its originators to make the semi-colon optional. I'm sure I need go no further in explaining the consequences of that debacle.
I have usually seen JSP's referred to as "scripts". That not withstanding, Sun is reported to be looking for a Java-compatible scripting language to endorse. JavaScript does not appear to be in the running; the top contenders (as near as I can tell) appear to be Jython and Groovy.
So, in conclusion, let's end all this confusion and just switch to Python on Linux.
I want to be a Groovy developer. Now that would have a certain ring to it. Do you know where I start?
I must take you up in this:
but the methods are part of the JS language
They just aren't. If you hooked up a Python interpreter to your doc, which I'm sure people do, then you'd use the same methods. They are part of the document interface.
setTimeout & alert aren't part of the OS but of the host, when it is the browser, referred to as window. I'm so used to using alert, that when I use the Windows Scripting Host, I usually put this at the top of the page, to create the function, since the host in this case doesn't have it...
alert = function(s){WScript.Echo(s)} The point I was making is that we don't bother putting people to task about this. They are commonly considered part of Javascript, why should we care?
The only reason it's worth making the point at times is for the purposes of understanding, or rather to point people in the right direction for reference sources. I have seen cases in forums where posters have complained about not finding setTimeout in whatever Javascript reference they are hunting in. "IT'S NOT JAVASCRIPT!" is often the loud response. This isn't just hair-splitting. It's useful information indeed if you are trying to find information about it in, for eg, The MS JScript manual (where neither it nor any W3C methods will be found).
One of the better write-ups on this is [mozilla.org ], where they give the Javascript and the DOM methods different colours to make the point. The thing is there, that they consider alert to be Javscript, whereas many certainly wouldn't consider it "core Javascript". I have seen experts admit that they aren't that sure where to draw the line where host methods like this are concerned.
In any case, the calls from the browser are to the OS to actually get the clock info. Hence my assertion that the fundamental functionality is thus derived. (In the old days we would have used assembler to get straight at the clock. That was when geeks coded Basic and real men hacked assembler. Now the geeks are ascendant and no one does assembler, anymore. It is a loss. That must be what is meant by ". . . and the geek shall inherit the dearth.")
As regards the DOM, it might reasonably said that they are JavaScript methods that call on similarly named objects that are defined under the DOM. At some point, however, we must acknowledge that all this becomes a rather tediously persistent application of flagellation to the expired equine.
If you really want to feel Groovy, here is the (purely authoritative, note the .org) link: [groovy.codehaus.org...]
Other pet peeves includes referring to dynamic pages and meaning a "?" character in the URL, the presence of a QUERY_STRING environment. Or talking about Apache and meaning Linux (I've been running Apache on windows for years now quite happily), or saying ASP and talking about a language, when ASP is a framework that supports many languages.
or referring to ANY kind of extension when talking about hte web, since the content type is ironically specified by the "Contet-Type" HTTP header, and the file extension has as much or as little relevance to my little black box analogy as files and folders.
The point I'm trying to make? Many experts don't know everything under the sun, and I constantly hear people who are much smarter then my and whom I highly respect make these distinction mistakes. Yes, one could think that they'd not mix up Java and JavaScript, but unless you're actually involved in using both of those technologies you may be forgiven the mistake as much as for any of hteother bits I listed, which didn't mean much to me either before I learned about them.
SN