Archived

This topic is now archived and is closed to further replies.

Java & JavaScript

This topic is 5003 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Java and Javascript are completely different despite similar names.

Javascript was chosen by the suits as a replacement name for what was originally to be called "Livescript" by Netscape in 1996ish. At the time the buzz over Java was so hot that they decided to get on the bandwagon. Unfortunately the result was a whole generation of very confused developers.

Javascript is appealing for writing very simple stuff, but it has limited abilities, isn''t terribly browser independent (the DOM and other pieces of API that need to be used if you''re doing complex client-server stuff). Javascript is also (I would judge) poor for programming in the large. It''s also relatively inefficient (but don''t let that stop you choosing it). It''s still fast enough for the low performance required of the applications which typically use it.

I''ve seen some good things done with JS. I''ve done a limited amount myself - a rather poor space invaders clone is all I managed (besides the usual form validation & dynamic menus that everyone knocks out)

Java on the other hand, is a serious language. It has a lot of drawbacks - a much larger client-side footprint is one of them, with much longer (typical) start-up times. But once you''ve got past those, you have a serious environment. I''ve seen a Quake-like engine coded in Java that was quite fast (OK, it was coded by a mental demo coding group partially in hand-optimised Java bytecode; I doubt it would run on a modern VM)

For client-server apps there are some *really* good things you can do in Java applets. Like using RMI (and indeed, being an EJB client is possible). This makes writing complex client-server apps quite possible.

And it has the advantage over a traditional client-server model, that your client code distribution problem is solved (although clearly there is an issue potentially arising out of people leaving browser windows open for days over software updates on the server).

Javascript combined with server-side scripts for adding more interactivity to web apps is a compelling environment. But it doesn''t really lend itself to tricky and/or critical apps.

Banks seem to be undecided on this one; there seems to be a pretty even split in online banking systems between HTML / Javascript and Java applets.

I had long thought that Javascript chatrooms were too error-prone; but I''ve seen a few implementations lately that are pretty good.

One thing that is *very* difficult with Javascript is server-push. It''s easy to do client pull. So lots of realtime JS applications work by polling, which is hugely inefficient - its scales *incredibly* badly (typical application: sports results). So people typically use a Java applet.

It''s all pretty much swings & roundabouts.

I''d say your target client base should be an important issue too - if you are in a bank or somewhere with a relatively tightly controlled client environment, your choice will be more open (on the other hand, your management might be more closed)

Mark

Share this post


Link to post
Share on other sites
Wow, that was a load of crap.

Since when can you use any version of j*script to do network programming? There is no comparison between whichever version of javascript you care to name and java.

javascript - used in a browser at most you can open a window or validate a form.

java - multithreading, native network support, opengl support, oop, etc....

To answer the question; you could use a java applet for the client and a chat server in java too.

Rhino, the java version of javascript used in Mozilla, has a featured called live connect you can use to create and use java classes from the javascript, but do to the java security sandbox you would never be able to use this to acces a different server.

[edited by - sagwagon on April 5, 2004 7:18:31 PM]

Share this post


Link to post
Share on other sites