PDA

View Full Version : Java & Javacsript Usage


rePete
Sat., Nov. 19, 2005, 9:17 am
Greetings to all,

As a relative neophyte to modern web design I guess I have become confused on the accepted use of these technologies on websites.

Who uses which and more importantly why? My system seems to slow down when the Java icon pops up in the task tray. But is this the same as a javascript?

The fact that I can turn either Java or Javscript off in my preferences leads me to believe that someone thinks they could be bad. Are they?

Bottom line might be: Do I want to use either Java or Javascript in my site redesign?

Thanks,
Pete

David Gillaspey
Sat., Nov. 19, 2005, 1:27 pm
Hi Pete,

I'll leave it to others on the forum to give a full answer, but here's my take:

Java and Javascript are not the same, despite the unfortunate similarity of names.

Java is a full-fledged object-oriented programming language. One could certainly develop Java-based applications for the web, but my feeling is that Java could be used in scenarios unrelated to the web.

I tried to learn Java once but gave up quickly. Way over my head.

By contrast, Javascript is a "client-side" web programming language that's really not too difficult to learn. (However, it's very picky. If you misspell a word by one character, code won't work.) It shares the same programming conventions (loops, if-then statements, switch, variables) as many other programming languages (web or non-web). There are numerous articles and tutorials on the internet related to JavaScript programming.

"Client-side" means the code runs in the user's browser. There are some advantages to that, some disadvantages. For example, know that all your Javascript code can be viewed by a user who is viewing the source of a HTML page.

One frequent use of Javascript is to "validate" HTML forms, which means to run a script that ensures the user has filled out all the (required) fields on a form before submitting it. This generally is a client-side function.

The opposite of client-side is server-side. PHP and (I think) ASP (Active Server Pages, a Microsoft technology) are examples. The former runs generally on Linux-based servers. The latter runs generally on Windows-based servers.

Server-side means the code runs (that is, is "executed") on the server BEFORE a page is ever sent to the user for viewing in a browser. There are some advantages to that, some disadvantages.

If you view the source of the pages on my website, you'll see no hint of PHP code. It was all executed on the server before the page was sent to your browser.

Long story short, you'll probably want to learn Javascript and one server-side language of your choice, either PHP or ASP. The former (PHP), being open-source, has become very popular among web programmers. There are other programming languages that may be of use to you also, e.g., Perl and VisualBasic.

Finally, you'll want to become knowledgeable about CSS (Cascading Style Sheets) and XHTML, so as to create "standards compliant" web pages. Some members of this forum advocate using CSS and XHTML to the fullest extent possible. With regard to CSS, as least, my position is, use CSS to the extent you're able.

The reason you can turn off Java or Javascript in preferences has to do with security: They can be used maliciously. However, I know if you turn off Javascript, you'll have a hard time accessing webpages.

Hope this is helpful.

Sincerely,

David Gillaspey
President
Great Church Websites
(and forum host and administrator)

mickmel
Sat., Nov. 19, 2005, 6:09 pm
Bottom line might be: Do I want to use either Java or Javascript in my site redesign?
Feel free to use it, but make sure you site works without it. Around 10% of users don't have Javascript (or have it disabled for security reasons). If your site needs JS to work, you've lost most of those visitors.

In my opinion, a site should not require any fancy technology to function - not Javascript, not Flash, not even images! You've gotta be pretty cocky if you think a user is going to enable/install something just to be able to view your site. In most cases, they'll just move on to a more accomodating site. That being said, you can use all of those items if you wish, as long as they're in moderation.

An example would be on our site with the JS menus. If a user visits that doesn't have JS, only the top level items work. However, the sub-menu appears on each page, so they can still navigate through.

In terms of Flash, I think a block of it on the site with a nice animation is ok. The problem is when the main navigation REQUIRES it. Bad news.

Hope that helps.

Mickey

ckvkkeek
Sun., Dec. 4, 2005, 9:59 pm
As stated, they are different.

Never use Java. Just so slow.

As for Java. I say use it for anything you wish (main navigation and all). It is impossible to make a website that pleases everybody that is scared of features and make it fancy looking. You could use ActiveX, but then you lose 15% (and growing) of the Netscape users.

I think the stat listed below is grossly overstated. I have only known 2 people to disable Javascript. But those two folks were scared of everything on the web. Java on the other hand requires a run time library to be installed, and many don't have that.