Secrets of the JavaScript Ninjas

Jeff,

How do you feel about Graceful Degradation when you’re working with Javascript? For example on your Stack Overflow site.

I remember from a while ago (prolly last year) there was a lot of buzz about all the JScript frameworks you’ve mentioned, but also a movement about micro-formats and graceful degradation of your site, when working with those frameworks.

Combined with proper CSS formatting, making it so that your entire site still works when Jscript and/or css is turned off.

Do you/are you going to invest time and energy in graceful degradation? Your point of view? :slight_smile:

Appendix to my previous comment:

I wanted to include an example by quoting picnicmob.org, but it’s offline :frowning:

I’ll show the port I did for it instead: http://picnicmob.eu/ Disabled jscript should still allow everything to work, except you see the radio boxes now, while jscript enabled hides them. And without css you go back to (very) old-school looks :stuck_out_tongue:

(Ps: The project of the site is dead, wasn’t really much interest for in Belgium)

How about the Google Web Toolkit? To heavyweight?

Hey, I like this blog and enjoy reading your posts…

…but sometimes I’d like to read an article with all the backlinks.

You end up refering to things you’ve posted before and by the end of it I will have needed to read the equvalent of a small book to really get your perspective on the subject.

It’s irritating and I end up feeling like everything is an iside joke.

I’ve been at a company now that uses prototype and the truth is it makes javascript really enjoyable.

JavaScript use to bother me with its dynamic typing and treating functions as first class variables but I’ve finally come to grips with it now.

I wasn’t aware that first class functions were a bad thing? I can understand being wary of a dynamic language - it’s usually either For or Against… but functions as first class citizens? Is there a negative?

You left out MochiKit! It’s a fabulous framework that has totally revolutionised my JS code. I can do so much now with so little effort!

Bart.

john resig is god!

What? Nobody else finds it odd that the cover of book entitled Secrets of the JavaScript Ninja instead features a samurai?

don’t you fucking dare make your website UNUSABLE with JS off.

I used to be a Javascript Ninja and I wholeheartedly think that jQuery is the way to go, if you are going to craft your site in Javascript. I’ve looked at them all: YUI, Ext, Moo, scriptaculous, dojo and a ton more that aren’t in the top 5. And JQuery is about as perfect as it gets in the Javascript world. Resig had a winner 18 months ago when it first started, and it’s now a force to be reckoned with. But…

(There’s always a but)

We (at our company) have veered off the Javascript road and are now blissfully speeding along the Google Web Toolkit superhighway. Like I said, I’m very comfortable writing Javascript. But the power and simplicity of GWT, especially when combined with a world class IDE like Eclipse (NetBeans is excellent too). It turns what can be a frustrating situation into a pleasure when writing and debugging code. If you are in a Java shop, or you’re vaguely familar with Java, it’s absolutely awesome. And if you’re in love with a particular feature of a javascript library…they’re fully compatible with each other. Once you set a break point on a client side line of code and step from client to server in the debugger…you’ll never go back.

Like I said, I dig JQuery (I think I want to be Resig when I grow up) and a lot of the other libraries, but GWT is really a different approach to the problem.

And now, we just need something similar for CSS. Maybe during the Web 3.0 era.

Can you tell us a few of these hundreds of differences in JavaScript implementations? What I understand the JavaScript implementations are quite identical (eventhough IE doesn’t recognize delete keyword).

I reckon the main difference is that the browsers create different kinds of DOM trees from same HTML and CSS is interpreted with varying accuracy causing some of the HTMLElement attributes to differ accross the browser engines.

@Josh
First class functions can add subtle errors to a program if they are used poorly. Also, it can make the code hard to follow sometimes. Note there are a few Java coders who don’t want closures added to Java 7 for this reason:
http://david.blog-city.com/closure_headache.htm
However, its all in how the tool is used it can be either good or evil. A lot of typical coders just don’t understand the nuances of the first class function concept to use it effectively which is where the negatives and maintenance headaches come in.

@o.s. appreciate the response, I’m only beginning to really look at the details of languages. I’m also glad you clarified how they can be used for good or evil - as any language or feature can be. I think in this case though, the problem would be the user of the tool not the tool itself?

That blog you posted pretty much sums it up nicely - ‘I dont understand it, it’s too hard, so I don’t want it’. Forgive the tone I’m not taking a dig at you. I’d much rather read the thoughts and views on the subject of closures in Java from somebody that understood them and had what I feel are justified reasons.

I also think that Yegge has brainwashed me a little.

I’m going to join in on all of the love for jQuery - I started to learn it along with Drupal, and it’s marvelous.

Word up. Jquery is pretty awesome. Call me a sickening individual, but I’ve always… wait for it… ENJOYED writing my own Javascript. It’s a lack of control type of phobia, I guess. But Jquery makes me so much more productive, I can’t look back. And I still feel in control because I understand how it works. It’s a fabulous compromise. Thanks John Resig!

Some co-workers and I have been talking about some of these frameworks for a while now (mostly about standardizing on one throughout the company) and this little gem came out. Useful for determining which framework to use if you’re doing mostly DOM work with selectors…

http://mootools.net/slickspeed/

Yeah, jQuery makes javascript into the second best dynamic language ever. Especially when you combine it with Ext for UI tasks.

(The best is still Ruby :slight_smile: )

If you know Java already, GWT (Google Web Toolkit) can’t be beat for cross browswer compatible JavaScript creation.