37 Comments
- headzoo, on 10/12/2007, -1/+12@kozmo - You are, IMO, a ***** idiot. I don't even know where to begin. I sure as hell hope you're not a computer programmer by trade, because you don't understand the idea behind not using a sledge hammer to kill a fly. You also surely don't understand the needs of the computer development community.
Go ahead and put a Java applet in a business website when two lines of JavaScript would do the trick. See how many people return to that site. - swillison, on 10/12/2007, -0/+9As the tutorial explains, JavaScript supports OOP - but using prototype inheritance (as seen in languages such as Self) rather than the class-based inheritance used in Java. That said, the distinction between scripting and programming languages has nothing to do with whether or not they support OOP - there are plenty of scripting languages with class-based inheritance, and plenty of programming languages that don't support OOP at all. How do you define the difference between the two?
- ext237, on 10/12/2007, -1/+7"Validation should happen on the server side."
That's what the web needs, more traffic across the network to make sure that Joe-blow typed in all 7 characters of a zip code. And the reason we spend tens-of-thousands of $$ for a load-balanced server farm is to validate that the massive concurrent user base is submitting numeric-only values in that zip code field.
The fact that the user's 600MHz or faster processor is idle while our servers do all the validation processing is irrelevant. Forgive the sarcasm, but disabling JavaScript for security concerns is akin to refusing to do online banking with an SSL system -- choosing instead to receive printed out statements in an unlocked mailbox on a pole next to the driveway. - exaviger, on 10/12/2007, -2/+7@headzoo
I do agree with your first statement but you too are not of a smart nature for your statement, you my friend are stuck in the 90's. When people talk about java on the web believe it or not the last thing they are thinking about is applets since applets are not web-based, they just run in a browser.
What kozmo was more then likely implying by the use of java is the fact that java is an exceptionally powerful and flexible architecture for web based development the most commonly known is the use of jsp pages to serve dynamic content.
Now let me see you insert two lines of java script code instead of an applet to a browser that has java script disabled and see how many people come back to your site.
Moral of the story and I don't mean to attack you but for the love of god stop thinking of applets when someone talks about web development using java. - Kitsune818, on 10/12/2007, -0/+4I'm a professional JS programmer (yes, we do exist). I can say, without a doubt, that in my company's situation no other language fits the bill. We do large, large, large amounts of data collection world-wide from poorly developed areas and need to do some things client-side (not just validation, but in a lot of circumstances tricky unit conversions, retyping, dynamic language translation, etc..) JS is neat, clean, and does the job very very well. We would be lost without the OO features of JS and that fact that nearly every browser on earth supports it. Doing things client-side cuts down on the total bandwidth requirements and helps us get around other restrictions.
- headzoo, on 10/12/2007, -0/+4"What kozmo was more then likely implying by the use of java is the fact that java is an exceptionally powerful and flexible architecture for web based development"
Nah, I think he was trying to be snot and acting like he's too cool for school. "Scripting language? Who me? Yeah right, I use a real mans programming language. I'm one 133t mofo."
Yes my choice to use the term applet may have been bad, but my mind certainly isn't stuck in the 90's. I was using applet as an example of one use of Java, not as the only use of Java.
The point I was trying to make is there is a proper language for a each situation. You don't need something as "robust" as Java when something as simple as JavaScript will do. So to completely blow off JavaScript because it's just for "quick hacks" is immediately closing your mind off to the simplest, most direct way to get a task done. That's why I pray I never have to work with him. You've got be smart enough to know when to use the right language in the right situation. i.e. not using a sledge hammer to kill a fly. - swillison, on 10/12/2007, -0/+3I agree - I'm a big fan of the principle of unobtrusive JavaScript, where scripts improve your user experience if you have JavaScript enabled but don't break anything if you don't. The linked tutorial is purely about JavaScript-the-language - it deliberately avoids talking about applications of it for the most part. Remember, JavaScript isn't just for the Web - the Firefox user interface is mostly written in JavaScript, and it's also used for things like Dashboard and Konfabulator widgets.
- GrinningFool, on 10/12/2007, -1/+4"That's what the web needs, more traffic across the network to make sure that Joe-blow typed in all 7 characters of a zip code. And the reason we spend tens-of-thousands of $$ for a load-balanced server farm is to validate that the massive concurrent user base is submitting numeric-only values in that zip code field."
"The fact that the user's 600MHz or faster processor is idle while our servers do all the validation processing is irrelevant. "
Wow, please tell me you don't even come NEAR any web development environments?
My point here has nothing to do with people who disable javascript. Are you even aware of how easy it is to bypass client-side validation? That, in fact, there are plugins for firefox that are designed to do just that? If you're relying on the client to validate your inputs, you're practically begging for invalid data at best, and security nightmares at worst.
Please, stay away from developing server-side applications until you've a better understanding of how it works. For the sake of your customers. - jerwood, on 10/12/2007, -0/+3I think the ideal solution is to do both client and server side validation. That way, you can give users quick feedback if they have JS enabled, and you check for sure on the server side anyway because you're not an idiot.
- anorris, on 10/12/2007, -0/+3Or... digg?
gmail and digg both do one important thing that many people neglect though, and that is to play nice when you have JS disabled. Both websites work fine without it, but with it provide an even better experience. As it should be. - andywaite, on 10/12/2007, -0/+3JavaScript is generally not required where a site is mainly intended for presenting information. However, for web applications it's very useful because the controls available in HTML (textbox, textarea, etc.) are so limited. JavaScripts allows a much richer range of controls to be built, e.g. sliders, drag'n'drop, dynamic re-ordering, and all the impressive AJAX controls which have been release recently. (What do you think is behind the Thumbs Up/Thumbs Down buttons on Digg?).
You probably /could/ design these sites differently so as not to use JS, but they would be much slower to use (since a full page reload would be needed), and less intuitive. - Strd, on 10/12/2007, -1/+3I see a lot of Java Script on the web where it's completely unnecessary. Many sites can not even be open without Java Script enabled, and nothing in them require actual use of JavaScript. I wish web designer apply ed more common sense in JavaScript usage. Especially as a lot of people use JavaScript blockers.
- tornamodo, on 10/12/2007, -0/+2nice one. pretty much the same there, but more compact:
http://javascript.infogami.com/Javascript_in_Ten_Minutes - jesusphreak, on 10/12/2007, -0/+2Digg doesn't. Go turn off JS and see if parts of the site work (that is unless they've changed something very recently).
- coolbru, on 10/12/2007, -0/+1Gmail's crappy CSS support is my biggest complaint.
- exaviger, on 10/12/2007, -0/+1I agree, I use j2ee/struts and I simply dont see the need for java script. Validation should happen on the server side. For quick little calculations I can understand but using Java Script to run your business logic is weird imo.
- swillison, on 10/12/2007, -0/+1Thanks for the link. Those notes are now being developed on the Mozilla Developer center; the version there has some bug fixes and is generally better: http://developer.mozilla.org/en/docs/A_re-introduction_to_JavaScript
If you're interested in the slides that accompanied the talk, you can check them out on Flickr: http://www.flickr.com/photos/simon/sets/72057594077197868/ - patricks, on 10/12/2007, -0/+1Obviously learning some implementation is important, however before you can implement you need to know the languages basics, namely it's syntax.
Furthermore, javascript is almost certainly not a learning language. It isn't something that you are going to get your programming education in. Therefore it is resonable to assume that someone who may read a javascript introduction article may be able to get by on some syntactical examples and be able to extrapolate his own real world examples from there.
But again, this was just an introduction, and in my world, the introduction to any new language is exactly what that article provided. Syntax, and language capabilities. - swillison, on 10/12/2007, -1/+2Scripting languages are a (poorly defined) subset of programming languages, so JavaScript is both.
- niknik, on 10/12/2007, -1/+2... guess not many people here see the good examples of javascript done properly, like... gmail?
- Bogtha, on 10/12/2007, -0/+1GMail is *awful* code. Go look at it. Browser detection, no graceful degradation, avoidance of HTML... it makes practically every mistake possible.
- coolbru, on 10/12/2007, -1/+2There's some very silly stuff being said in here - GrinningFool is living up to his name and jerwood is spot on, as is ext237 (who was not suggesting client-side only). Client-side validation is significantly better for the user experience, but it in no way obviates the need to do the same thing on the server side. You should ALWAYS validate server side, but you can optionally validate client-side, and doing so can improve both speed and interface quality. No-one in their right mind would suggest doing it only client-side.
- Bogtha, on 10/12/2007, -0/+1@andywaite,
> You probably /could/ design these sites differently so as not to use JS, but they would be much slower to use (since a full page reload would be needed), and less intuitive.
No, they would only be slower *if the user didn't have JavaScript available*.
It's perfectly possible to write JavaScript so that it has all the fancy stuff for the people with JavaScript available, but still works when JavaScript is off. Unfortunately, the vast majority of web developers are quite ignorant, and think you have to choose between fancy effects and compatibility. This is not true.
@jesusphreak,
> They'd actually be much faster with JS turned off.
That depends on the particular circumstances. JavaScript can often drastically speed things up. Remember when GMail first came out and everybody was talking about how fast it was? There's no way they'd get that kind of performance without JavaScript. - patricks, on 10/12/2007, -0/+1"This article lacks reference to many powerful javascript functions and capabilities. Also, it steers away from the entire idea of form interpretation and processing with the exception of a few vague references to the getElementById function."
You must have missed the part... i think its the first line, where it says, "A Re-INTRODUCTION to Javascript"
Sure certain points of the language weren't discussed. But thats why it was an introduction, nothing more. - Xopl, on 10/12/2007, -0/+1I like that there is not a lot of text, and a whole lot of examples. Makes scanning the page easy and informative.
- BooshTukka, on 10/12/2007, -1/+1I disagree. The inital loading of the page would be quicker, but the user interface would be much slower. Every single thing you wanted to achieve would require a reload of the page. I agree that it should only be used where it is necessary, and if you can, offer an alternative - but when we have all this functionality and speed available - I want that to be used to improve my user experience. I don't want to be held back because someone still has Windows 3.11 on a 286 somewhere.
- inactive, on 10/12/2007, -0/+0If you ask me, I think that the methods that I mentioned should be included in any article, regardless of if it's an INTRODUCTION or not...
What is the purpose of being introduced to something if you aren't given real-world examples of its capabilities?
"Here is a brief summary of JavaScript's syntax..."
"We'll discuss its uses later. After all, this is only an introduction. Honestly, why would you want to know how to usefully implement the language that you were just taught?" - inactive, on 10/12/2007, -0/+0This article lacks reference to many powerful javascript functions and capabilities. Also, it steers away from the entire idea of form interpretation and processing with the exception of a few vague references to the getElementById function.
Javascript should in no way be used as a primary method of data validation, but it is, in my opinion, fairly handy when you need to verify that a few strict rules are followed.
Nonetheless, this article could serve as a good reference to developers that are unfamiliar with the language.
EDIT: I just received an "unterminated string constant" javascript error in the midst of correcting a typo. Fairly ironic. - jesusphreak, on 10/12/2007, -1/+1What do you guys do when people have JS disabled? Your entire application just doesn't work?
Especially in "poorly-developed areas" it seems it would be much better to do that kind of work on a the server where you can control it and you know it will always work. A lot of people who aren't on the cutting edge of tech don't have the same versions of JS or just have it turned off and that can lead to major problems. - exaviger, on 10/12/2007, -1/+1@ext237
Ok so you have a registration form with fields for zip codes, banking details, contact details etc ..
A user has java script disabled and enters invalid data onto the form that was meant to be validated.
Depends on your organization and service offered an email or phone call would have to be made to the person that entered invalid details to inquire what the correct details are or the registration would simply be useless due to invalid data.
Take any e-commerce company that requires shipping of goods to customers, think of the cost, time and effort it would take to have to contact every individual that entered invalid information as opposed to a couple extra milliseconds of cpu usage and bandwidth it would take to validate it on the server side.
Hardware and bandwidth is cheaper in most cases then having to go after individuals to request the correct data from them. Oh sure you can just email automatically but john smith forgot to enter @ or . in his email address and it wasn't validated.
". Forgive the sarcasm, but disabling JavaScript for security concerns is akin to refusing to do online banking with an SSL system"
Perhaps but the reality is people do disable it. - dpant, on 10/12/2007, -0/+0guys there is no "js disabled" issue. grow up this is year 2006. whoever has js disabled is probably also afraid of computers altogether. not even a statistic.
- jesusphreak, on 10/12/2007, -3/+1Yeah, Digg would be one of those sites that break when JS is off.
> You probably /could/ design these sites differently so as not to use JS, but they would be much slower to use (since a full page reload would be needed), and less intuitive.
Not true in the least. They'd actually be much faster with JS turned off.
JS is cool, but there's no excuse these days for having your sites not work when its turned off. - kozmo, on 10/12/2007, -3/+0Obviously, headzoo has his head up his arse. He presumes to know my intentions behind my comments, and my skillset, without knowing anything about me. That not only makes headzoo a snot, but unprofessional. If his displays the same attitude at work as he does on this thread, I'm betting his co-workers can't wait to see him leave.
- exaviger, on 10/12/2007, -4/+1(moved to correct thread)
- swillison, on 10/12/2007, -6/+0(moved to correct thread)
- kozmo, on 10/12/2007, -12/+1JavaScript is a scripting language, not a programming language.
- kozmo, on 10/12/2007, -15/+0Scripting language, IMO, are nothing more than quick hacks. If you want true OOP functionality then you need to use a programming language such as Java.


What is Digg?
The Digg Toolbar for Firefox lets you Digg, submit content, and keep track of Digg even when you're not on the Digg site. Download the official