The Artima Developer Community
Sponsored Link

Java Buzz Forum
Embracing JavaScript

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Brian McCallister

Posts: 1282
Nickname: frums
Registered: Sep, 2003

Brian McCallister is JustaProgrammer who thinks too much.
Embracing JavaScript Posted: Apr 17, 2006 10:45 PM
Reply to this message Reply

This post originated from an RSS feed registered with Java Buzz by Brian McCallister.
Original Post: Embracing JavaScript
Feed Title: Waste of Time
Feed URL: http://kasparov.skife.org/blog/index.rss
Feed Description: A simple waste of time and weblog experiment
Latest Java Buzz Posts
Latest Java Buzz Posts by Brian McCallister
Latest Posts From Waste of Time

Advertisement

I've, lately, had the opportunity to do a lot of JavaScript and Ajax hacking in anger. Summary, holy crap, JavaScript hacking has come a long way =)

The biggest thing, I think, is to embrace JavaScript. It has such a dirty feel from ten years ago that this sounds anethema to many, but it is worth it in the same way that you are better off embracing SQL, or HTTP rather than trying to shove them under a lossy abstraction layer.

The vast majority of tools available, even the really sexy ones, try hard to shield you from JavaScript. While I do, at the moment, much prefer hacking Ruby and Java (and I am so damned happy that Ruby is blazing a fiery trail across the sky as it makes it a much easier internal sell ;-) to JavaScript, it really does you a disservice.

The main disservice it does you, I think, is to force you to think in terms of the classic web. This is the wrong model. JavaScript doesn't buy you visual effects, it buys you a better way of building big web-based systems. Welcome to the top of the line scaling problem #2, you just got promoted.

JavaScript is a weird little language, squirrely, but really rather powerful (meaning expressive and useful). Use it. Embrace it. Go buy Professional JavaScript for Web Developers -- it is the best guide to the language I have found.

Tool wise, I have been extremely impressed by Dojo. For one-off effects, or for use with Rails (because of the tight RJS integration) I'd probably still use Prototype, but my tool of choice has definately become Dojo -- when working in JavaScript.

Alongside Dojo, I have been getting great mileage out of TrimPath's JavaScript Templates. This is a great little templating system for Javascript, which combined with JSON (which rocks, forget XML for JavaScript hackery), lets you push most of your work out onto the client. This also rocks. I haven't used their "Rails in JavaScript" thing, nor the SQL liek bit, those seem a bit too much of trying to be something they are not, and I think taking a Model2 approach in JavaScript is the wrong way -- you can do NeXT/Cocoa style MVC very easily, why go to Model2?

JST is easy to hook into dojo, add a line to the JST source:

dojo.provide("trimpath.template")

Tell dojo where to find the trimpath stuff:

// path is relative to dojo
dojo.setModulePrefix("trimpath", "../trimpath");

And you can treat it like any other Dojo bit:

dojo.require("trimpath.template")

Transitive dependency management is fantastic. Sure, for production you will probably compile up a file with everything you need, but during development this rocks, and for exporting services (if you happen to be building a platform for social software, for instance) and want to make life easy for your users (developers), it is even more useful.

Anyway, lots of fun JS hackery, probably going to be writing a lot more about it.

Read: Embracing JavaScript

Topic: When only the glib win, we all lose Previous Topic   Next Topic Topic: The Happy i5 Family [Flickr]

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use