JavaScript is often ridiculed as the black sheep of programming languages. Nearly every Web developer has cursed JavaScript at one time or another. Until recently, many developers had all but written off JavaScript as a necessary evil at best or a toy at worst. But JavaScript is becoming increasingly important. See why it remains the most broadly available scripting language for Web development and a better choice for developing modern applications.
Yes, I used to think it was a joke – then I switched to Firefox, got Firebug, and now it’s a dream to code in.
Then I had to debug for IE….
Quote: Then I had to debug for IE….
There lies the real problem. Web developers don’t curse at javascript the language, they curse the web BROWSER and all the little idiosyncrasies that make us head bang our desk.
Aye, thanks Microsoft, thanks for truely putting the web back 10 years. (It’s the 10th anniversery of CSS, and MS still hasn’t implemented CSS1 properly)
The icon of the news shouldn’t be the one of Sun Java because they’re two completely different things
Just shows how much javascript is misunderstood because of the bad name.
Java != Javascript . Put the Netscape icon, it suits better.
Once you get past the irritation of the “uneven” platforms for javascript (browsers), the language itself is fascinating to work with. A really good example of how just how different javascript programs can ‘look’ is the protoype library [http://prototype.conio.net/] (bad name IMO, name clash is not helpful!), where each ‘class’ or ‘function’ is only a few lines of code, but the thing as a whole is very tightly interwoven, from whence it becomes so powerful.
I’ve seen interesting discussions regarding IE with CSS and Javascript, where it was pointed out that although IE7 improved the CSS, the javscript implementation was left virtually unchanged. Firefox is up to about Javscript 1.7 now, and IE is well behind.
2p’s worth
–Robin
Well something changed because I have this horrendous authentication gateway leading to a 3rd party (out of box) solution where it loads the interior page in an iFrame and uses java script to fetch a 1×1 transparent gif every 8 minutes to keep the session alive. Works fine in FF, Opera, Safari, and IE6… but it refreshes the whole page every second in IE7.
Javascript, when used correctly is fantastic, but so many sites use it in the wrong way, e.g. Annoying flashing adverts that follow you around the page, unnecessary rollover effects. To me, this has certainly given Javascript a bad reputation.
Although I never use to use Javascript, I now find it extremely useful. AJAX, live form validation, live searches, and even games (Anyone seen the Javascript version of Lemmings! ).
The worst part of using Javascript is attempting to debug it, although I use Firefox with Firebug, sometimes errors will appear in IE that can’t be replicated in Firefox. IE hardly ever gives a descriptive error message, and in my opinion it is extremely frustrating. If anyone knows of a good debugging tool for IE then please let me know .
Another problem I found is since Javascript has a bad reputation, some companies or users block it. You then have to develop around people who do this, which not only slows you down, it can also limit the functionality of your web application.
If anyone knows of a good debugging tool for IE then please let me know
I think the next version of VS (Orcas) is going to have a JS debugger in it.
You can already debug JavaScript with the current version of VS and it works great.
One can use the free Microsoft Script Debugger, but VS is more powerfull, script browser, imediate window for live JS evaluations, etc
Microsoft Script Debugger and Visual Studio.NET can be used, you need to turn on some options in IE (7 at least) to enable debugging capabilities.
MS Script Debugger:
http://www.microsoft.com/downloads/details.aspx?familyid=2f465be0-9…
… and the script editor that comes with Office XP (2002) and 2003.
Edited 2006-12-19 20:18
Firebug Lite can at least give you a good logger and command line to start with
http://getfirebug.com/lite.html
Fiddler can help immensely w/ debugging javascript.
Also, you can debug Javascript within VS by attaching to the iexplore.exe process…then just debug like you would any other code from within the IDE. I’m assuming you can do this w/ Visual Web Developer (free download) but I’m not sure as I haven’t tried it. All other (paid) versions of VS you can.
If you’re looking for a great JavaScript framework that really makes complex tasks simple, you need to look at jQuery. This library allows for complex selectors based on advanced CSS, plus xpath-like selectors, or any combination of the two. It has great documentation when compared to Prototype, etc. It has a great implementation for special effects, something like Scriptaculous or MooFX, but I like the jQuery method better. Speaking of method, in jQuery methods can be chained together for complex operations. Finally, it has a plugin architecture and a ton of plugins. As a matter of fact, it is easy to create plugins for your own use. I promise that after spending a couple of weeks using jQuery, any serious developer will wonder how they ever lived without it. Oh, and the site is: http://jquery.com
I’ve been using JavaScript for 6 years now, and I’ve grown to really appreciate the language. It really can do a lot powerful, cool, fun, and useful stuff. True, it has some relative weaknesses compared to static typed language, and true it can’t really be used to build systems or middleware. But JavaScript rocks on client side for web development.
It just gets a bad name because of poor browser implementation (IE), not enough debugging tools, or not enough tools in general.
But thanks largely to Ajax, JavaScript is starting to get some long overdue respect.
One of the interesting features of Javascript is that the libraries have a large impact on the feel of the language. Dojo, MochiKit, jQuery, YUI, and Prototype all have a very different feel when you’re working with them. I think a lot of it is due to the secondary-language nature of javascript.
What I mean by that is that javascript is almost always used in tandem with a different server-side language on a particular project. It’s interesting to see how the libraries reflect the nature of the primary language: Dojo/YUI (Java), MochiKit (Python), Prototype (Ruby). The odd one out is jQuery, which I feel most closely ties to xpath/xslt but I don’t know what the authors prefer.
The strength of javascript is that there are very few constructs, which makes it easy to adapt to various programming styles. The downsides are the lack of real namespacing and broken comparison operations. I’d add iteration, but that is handled in 1.7 or in browsers today with MochiKit or Prototype iterators.
As for libraries, I prefer MochiKit for general use and tend to port other pieces as needed. Second choice is jQuery. If you need something that only dojo provides (dojo.io, dojo.event, dojo.storage) then dojo is obviously your choice but YUI has better widgets.
For debugging on IE, Doug Crockford (the JSON guy, Yahoo’s lead js architect) says that Microsoft ships three debuggers capable of handling javascript. The free one that’s available for download sucks, but there is also a good one available as part of MS Office and a good one in Visual Studio. This is from his ‘advanced javascript’ lecture (I think part 3 but maybe part 2), which you can watch online.
The problems with Javascript are mainly of implementation, rather than the features of the language itself. For example, there is no inherent reason why Javascript can’t be used as a scripting language just like Python or Ruby. Unfortunately, the only experience most of us have with Javascript is as an embedded engine in the web browser, with bindings for the Document Object Model as its only connection to the outside world.
Personally, I would love to be able to use Javascript as a generic scripting language, with a robust interpreter on the order of Python, Ruby, PHP, and with libraries for system/os execution, databases, and all of the other standardly used interfaces. For more insight on the greatly underrated features of Javascript, read some of these articles:
http://javascript.crockford.com/
There have been a few attempts at making alternative scripting environments for Javascript, for example as an Apache server-side module, and as a GUI toolkit scripter in KDE/Qt, as well as Jscript inside the Microsoft Windows Scripting Host. Unfortunately, all of these are limited in their own way, rather than deriving from a general scripting engine. Anyone know of any others?
Well, yes , I know another one.
The new Java 1.6 & its new VM scripting capabilities ships with a version of javascript (Rhino I think).
You can even script apps with javascript if you don’t want to learn Applescript. There is a freeware Open Scripting Architecture plugin that implements js here : http://www.latenightsw.com/freeware/JavaScriptOSA/index.html
I agree it has gotten a bad rep through misuse. I have it disabled myself most of the time because of people who use it to anoy their users by using it for adds or disabling right-clicks or some such nonsense.
I’m not `into’ Javascript/ECMAScript, but this sure looks nice:
http://lambda-the-ultimate.org/node/1543
(describing ECMAScript Edition 4, which sounds like “next generation javascript” to me, though I might be mistaken )
As average Joe user, I find javascript to be a nuisance. Pages requiring javascript, along with those requiring flash, force me to turn it off completely and decide which sites are worthy of my opening a new instance of browser. This is due to the firefox and opera unix based browsers crashing and coredumping consistently with such content. I never have as many problems viewing this web content in Windows.
Tonywob mentioned that users sometimes block javascript, and I do the same. I feel that any content that cannot be displayed on all browsers is content not meant for me.
http://www.anybrowser.org/campaign/abdesign2.html#javascript
“Tonywob mentioned that users sometimes block javascript, and I do the same. I feel that any content that cannot be displayed on all browsers is content not meant for me. “
Often I found the following situation: JS is used to load “Flash” advertisements and annoying popups. In this case, disabling JS is a good way (as well as disabling / not installing “Flash”). The same problem usually occurs with non-standard HTML abuse.
In many cases, the HTML (noscript) tag construct is missing for those who do not have / support JS. This should be mandatory to be done, just as checking the existance of a file before accessing it.
JS offers some very useful features if it’s used correctly, it’s strong on client side. But it’s a shame many browsers interpret JS in different ways so the same code gives you different results on different browsers. If this does not change, JS will not get the attention it deserves. Personally I like using JS for things that cannot be implemented with HTML and CSS, but many scriptkiddies – I don’t know if you have this term in english – misuse JS as a replacement for HTML and CSS. And if you don’t have the correct browser type and version, you see… nothing.
Javascript is a great language. It’s a shame it’s hampered so much by the huge SUCK that are all browsers.
If you’ve not seen this before, it’s a very interesting read. This is the Job that Brendan Gregg (author of the DTrace toolkit) did in his first few weeks as a Sun developer earlier in the year.
http://blogs.sun.com/brendan/entry/dtrace_meets_javascript
Basically he has written a DTrace provider for javascript inside firefox. The article shows some very nice stuff.
alan.
blocking linux and other browsers than MSIE and Netscape 4 – 5
Until Javascript get full OO support and be more serious, it ain’t no real serious option for serious apps developpement. I mean, would you develop a real complex app from A to Z using Javascript? Sure no, it’s hell! Javascript need full OO implementation, some strict base to be built upon. Once this done, we’ll see some serious server-side Javascript. Imagine being able to code something that would execute in its same form on the server side than in the browser.
Usability, features, structure; that’s what lack this language. Current JS is still a hack of a 10 years old technology. AJAX may be cute, but updating hand-written code will be a hell of a mess if no good doc have been written. Thinking about all this only leave me a word: Immature. That’s right, the language is immature. Netscape left it behind a while ago (or is it Netscape that got passed by?), and now the language would need a serious overhoal.
Thinking about this, why not a new language in browser?
“Until Javascript get full OO support and be more serious, it ain’t no real serious option for serious apps developpement.”
It would seem you’re missing the entire point of javascript (notice the word script…it’s a scripting language).
“Imagine being able to code something that would execute in its same form on the server side than in the browser.”
Have you heard of ASP.NET? Java faces/struts? These are compiled server side code solutions that both blow the doors off of scripted languages when it comes to ease of writing, speed, etc.
I’m not even going to continue…
That’s ecmascript, javascript is only a myth.
You know you’re dealing with an awesome language when you can write LISPy stuff like this:
for (var i = sz – 1; i >= 0; –i)
if (i > 0)
f = (function(curLock, curFunc) { return function() { return $NS.synchro(curLock, priority, curFunc, ms); }; })(lockName, f);
[i]Edited 2006-12-20 18:55
If you want Microsoft to improve the javascript support, detect the java script version supported, and report that the site is part of the web 2.0 and inaccessible with antiquated browsers, and recommend any browser that meets the requirements, citing Firefox & Opera with direct-links 🙂
This will help bring the normal people onto more conformal software solutions, and will help ensure Microsoft updates their implementation to head off such a movement. Needs to be on a wider scale to really have an impact, though even if you can get a few thousand people to see that message, and have it automatically send off an e-mail in protest to Microsoft for their lack of conformance with modern standards.
That lack of conformance, in effect, is slowing the advancement of the internet, and causing the creation of bugs in a space where bugs were normally fairly rare ( in the ‘good old days’ of Netscape 3.x ).
–The loon