PDA

View Full Version : JavaScript/DHTML newbie -- general questions



sergiu
07-28-2005, 09:03 PM
Hi all,

I am new to Web programming, most of the time have done GUI development in C++/MFC and played a bit with Java/Swing.
I have read about DHTML and its ability to enable interactive Web applications.
Before delving into DHTML programming I would like to know what are the surprises; people in my group ask the following questions:

1. Why do we need this DHTML stuff? (after all, we already have Java)
2. Does it work across browsers?
3. Are there any development tools that support DHTML programming?
4. Can we use DHTML to develop GUI applications like we do with Java?

Thanks for your time,
Sergiu.

Willdawg
07-29-2005, 02:16 AM
... DHTML it's an acronym for Dynamic Hyper Text Markup Language. It's really an extension of html I don't know what you mean by GUI I know what it stands for Graphical User Interface but you do that a lot with java? Or do you mean javascript. Javascript is a scripting language with many pusposes you could make games,apps, w/e. It is slow but DHTML does not have this capability I'm pretty sure. I'm not exactly sure what it is :P haha I do use parts of it though haha.

edit: and if you meant Java then wtf are you talking about java is slow as hell for loading why would you make a GUI for a site in it when it could be done in HTML and javascript.

jscheuer1
07-29-2005, 06:13 AM
1. Why do we need this DHTML stuff? (after all, we already have Java)
You don't need it unless you want faster loading effects than you can get with Java (especially on non IE browsers).
2. Does it work across browsers?
Yes. It can be tricky at times though, owing to browser peculiarities.
3. Are there any development tools that support DHTML programming?
A good text editor. :D And many of these WYSIWYG HTML editors support it in a limited fashion.
4. Can we use DHTML to develop GUI applications like we do with Java?
Yes but, the operative word is 'like'. They will not, in most cases, be the same. DHTML is more suited to simpler applications than what Java is capable of. If all you are going for is a slideshow or document effect, DHTML is far superior owing to load time.

DHTML is really not any one thing, rather the body of devised schemes (for lack of a better word) employing javascript, html and, often css style. Also used, at times, are PHP, xml and whatever else is handy or suited to one's particular purpose(s).

Twey
07-29-2005, 10:25 AM
4. Can we use DHTML to develop GUI applications like we do with Java?
No, not at all. Applications cannot be written in DHTML. In Java terminology, DHTML is for applets that interact with the page more than standard Java applets are allowed to (although Javascript can be used to interact with a Java applet for the same effect). DHTML has nowhere near the power of a Java application; this isn't what it was designed for. You can design a GUI for your webpage, using HTML instead of AWT/Swing, but for anything very complicated, Java is necessary. For simple interactivity or pretty effects, DHTML has the advantage, due to its speed. For anything that requires more power (sockets, advanced graphics, 3D...) a Java applet is required.

sergiu
07-29-2005, 03:50 PM
Hi jscheuer1 and Twey,

Your replies are very helpfull!


Yes but, the operative word is 'like'. They will not, in most cases, be the same. DHTML is more suited to simpler applications than what Java is capable of. If all you are going for is a slideshow or document effect, DHTML is far superior owing to load time.

What makes Java more suitable for developing GUI applications than JavaScript+DHTML? Is there a sharp answer?


No, not at all. Applications cannot be written in DHTML. In Java terminology, DHTML is for applets that interact with the page more than standard Java applets are allowed to (although Javascript can be used to interact with a Java applet for the same effect). DHTML has nowhere near the power of a Java application; this isn't what it was designed for. You can design a GUI for your webpage, using HTML instead of AWT/Swing, but for anything very complicated, Java is necessary. For simple interactivity or pretty effects, DHTML has the advantage, due to its speed. For anything that requires more power (sockets, advanced graphics, 3D...) a Java applet is required.

What things cannot be done using JavaScript+DHTML? (please correct me)

1. Cannot open sockets -- but, can load data from Web servers (e.g. through HTTP, FTP, SOAP). In other words: no access to low-level communication protocols -- I presume that most of us can live without that.

2. Advanced graphics -- what exactly do you mean by this? An application like MS Outlook requires "advanced graphics"? An application like the editor I am using right now to post this message requires "advanced graphics"?

3. 3D -- OK, I can live without 3D for a while ;-)


Thanks for your patience,
Adrian.

Twey
07-29-2005, 04:25 PM
1) It can only run within a web browser.
2) It has NO socket capabilities at all.
3) By "advanced graphics" I mean... well... basically any graphics. There is the HTML <img> element, and it can be moved around with Javascript. That's about all.

HTML is not a real language - any more than PDF is. It's a format to present documents, that's all. Its elements were never originally designed for interaction, and while they now do have such support, it's not as powerful as a real programming language's. Javascript is a language, but it was only designed to manipulate HTML. Javascript basically edits HTML on the fly.

Willdawg
07-29-2005, 05:40 PM
it cannot open sockets but you can with XML. If you're thinking of making something multiplayer or a chat room. dhtml/javascript can do it but you wouldn't get any speed.

Twey
07-29-2005, 07:03 PM
it cannot open sockets but you can with XML.
XML isn't even a language. It's merely a format for storing data that makes it easier to access for XML-aware programs. You cannot open sockets with it; you can, in certain cases, use it to instruct another program to open sockets. DHTML could not, in any manner, create a multiplayer game or chat room. It could interact with something server-side to achieve a similar effect, with difficulty, but it couldn't do it by itself.

sergiu
08-01-2005, 03:48 PM
It has NO socket capabilities at all.

Why someone would want to open sockets?
In other words, why someone would work with a low-level API (sockets) when he can work with a high-level API (WebServices)?


"advanced graphics"

"advanced graphics" == "vectorial graphics" ?
Please provide few examples for what would you do with "adavanced graphics".

Twey
08-01-2005, 04:47 PM
3) By "advanced graphics" I mean... well... basically any graphics. There is the HTML <img> element, and it can be moved around with Javascript. That's about all.


In other words, why someone would work with a low-level API (sockets) when he can work with a high-level API (WebServices)?
Sorry, say "network capabilities" not "socket capabilities." The only thing it can do is redirect the browser to another page.

sergiu
08-01-2005, 10:16 PM
Hi Twey,

Can the browser contact WebService providers?
If it can, then this is more than redirecting to another page.

Sergiu.