Using hash routes allows you to keep track of state and decouple event handlers that set state from code that updates the page. Plus you get back button functionality and bookmark support.
Some background info on hashchange: http://blog.whatwg.org/this-week-in-html-5-episode-3
jquery library for dealing directly with hashchange: http://benalman.com/projects/jquery-bbq-plugin/
Higher-level jquery library for handling hashchange: http://code.quirkey.com/sammy/ . It has more assumptions and imposes more constraints on the structure of your code. But in return you get route parsing and a DSL.
If you go through the examples/tutorials in those two libraries you should gain enough knowledge to get started.
the first implementation i've seen of this is in Flickr. i was amazed when i ran into it yesterday. you have to be signed in to preview the new photo pages, but the zoomed/lightboxed photo pages use HTML5 history in compatible browsers and fall back when they can't. their JS is viewable at: http://l.yimg.com/g/combo.gne?j/history-manager.js.v90829.14
Especially because we're talking js now, I think it's a hell of a task, as I have this impression the language was designed to duplicate as much code as you possibly can. It's not Python or Ruby and you have to understand it inside out to make it right. In Ruby, for example, it's easy to write nice looking code even if you're a beginner. I haven't tried ExtJS or some other frameworks, maybe they provide some necessary background that helps you organize things better. But jQuery and Prototype definitely don't do that. Then there's the question of testing, which is a pain in the ass in javascript, even though we have nice tools like jspec.
So I'd be really careful. Chances are you'll end up with lots of crappy code in js that would be hard to maintain, especially if your frontend is big and you don't have experience in creating interface frameworks.
You're right about the limits of jquery, but JavaScript is not like Java inasmuch as repetitious JavaScript is a near-sure sign that you're doing it wrong. I'm working on a larger script too these days, and code organization is a problem for me, too, but repetition isn't really.
I managed to find a better answer than it is suggested there, though.
Next, you need to decide whether you will transport XML/JSON and have client-side code stick in in the DOM, or eval the AJAX response. In the latter case, you need to be generating JavaScript on the server-side. I know the Ruby on Rails RJS piece of the stack can be extracted from Rails 3, but I'm unsure about Python, so you might be better off taking the former approach.
There's a lot you can do with regards to animation in Prototype/jQuery alone, but I like Scriptaculous, and I've heard good things about MooTools.
Making a GMail-like interface isn't all about XML-HTTP-Requests though. There's a lot of value in nailing the usability, the basic concept. Then there's maintaining the history, undoable actions, HTML fallback and such.
My best advice is to start building a decent static interface from the ground up, and when you have it nailed, just augment all the minor GET actions with AJAX first (like going back to the index after reading an email). Then enhance primary POST and UPDATE actions (replying, marking with a star, moving to archive).
Half way through, you'll probably notice most of the page reloads that remain are acceptable. At that point, focus on refining the original concept with new methodologies you picked up along the way.
It's just the way I do it though, make sure you investigate other suggestions to find a perfect fit (by the looks of it, GWT is quite a paradigm-shift).
If you just want the look and feel of Gmail, there are plenty of frameworks referenced in the comments (Cappucinno, YUI2, Sencha, etc) that can give you the basic layout. But if you want the mimic the speed/functionality, it'll require getting dirty with Javascript controller design in the browser.
If you take a look at gmail in a debugger you'll see there are 4 iframes. The controller is the 'js_frame', the 'canvas' contains the graphic UI elements.
Leaving the canvas in its own iframe allows it to be reloaded separately without affecting application state.
Javascript still modifies the canvas iframe DOM. But that modification is cross-frame from the controller iframe.
I used a similar frame-based technique back in '97 when our enterprise startup needed a snappy native-looking zero-deploy UI.
Caoouccino/Objective-J, from the YC-funded 180north guys. It's an Onjective-C like language that compiles to web apps (and now Mac apps, too). It was used recently to create a Github issue tracker app, which looks pretty sweet.
No one seems to have mentioned SproutCore, which had a lot of buzz for a while since Apple was using it to develop their own webapps. It had a 1.0 release just a few months ago, but the buzz seems to have died down and I haven't seen any new projects using it. Apple is using something else now. Still, it's one option to check out:
Finally, if you do wind up working at the JavaScript level, I strongly recommend that you try CoffeeScript, which has a very Python-like syntax yet compiles directly to JavaScript. I've used it with jQuery for some pretty complex apps, and it's definitely made me a lot more productive:
On the other hand, its designer tool is the only free one among javascript frameworks. However, it is quite new, and a bit buggy.
Or GWT, just like GMail.
GWT though would be a step towards the OP's solution.
Also, if GMail is such a successful use case for Closure library, one could wonder why did they build Google Wave client with GWT?
http://news.ycombinator.com/item?id=56758
(Paul Buchheit was GMail's creator and lead developer)
Also, here is more proof:
http://news.ycombinator.com/item?id=190151
You could tell me: "OK, but it doesn't prove that current GMail is not in GWT. It may have been rewritten". I'd answer that:
- using firebug and looking at the js scripts loaded by GMail, there is no trace of GWT (things such as *.nocache.js scripts). They might have obfuscated to hide it, but why do that?
- if Google indeed rewrote GMail using GWT, they would have announced it, like they did for Wave / Adwords.
More discussion in this other thread: http://news.ycombinator.com/item?id=1470633
You can read more about it the website, user blogs, or in this month's php|architect magazine cover story http://www.phparch.com/magazine/2010/may/.
Note that if you're really interested you can join us in our #noloh IRC room and someone can help you put together a prototype in relative short order.
Disclaimer: I'm a co-founder of NOLOH.
I primarily code in Py, but I do really want to sit down with GWT some day, it looks badass.
In a lot of my projects I just use raw JS. Big libraries scare me sometimes and honestly, JS isn't that hard if you know what you're doing and know how to code around the main browser issues. I like some of the functional paradigms from mootools though (well any other lib for that matter), and the XHR handling.
(sorry I didn't really answer your question -- just rambled a bit before I go to sleep)
Pyjamas is an RIA framework that started as a port of GWT to Python. Development has recently sparked up and they now offer new features beyond what GWT can offer.
In order to integrate pylons with pyjamas, I've started work on a JSONRPCController base class that I hope will eventually be included in pylons. Eventually I'd like to add other things like a project template and setuptools commands for compiling and deploying a pylons+pyjamas app.
You can get a peek at what I've started on my blog: http://agentultra.com
Then choose in which language the server talks to the world(browsers, mobile apps, native apps, flash,...) usually through json or xml services, REST or not. You are building your API at the same time.
For each platform you can choose different techniques depending on your skills and needs. I'm not a fan of auto-pilot frameworks. I always felt they force me to think their way to build my thoughts(a personal limitation probably).
When we faced this decision to build our app, we took HTML5. We know it well and it works on all platforms. Native apps are cool, but we can't afford them as a startup.
Then on the browser, when you get the data you have to represent them. I was a fan of XML+XSLT and used to templating logic on the browser. We use JSON now, and have built a template engine(PURE) for a similar approach and get a fast HTML rendering of JSON data.
And we took jquery to cope with the DOM and browser differences.
The server streams only data, the network likes it. The browser render all this very fast. And this makes a very responsive app.
BTW, GWT is one option. Some JS libraries such as JQuery is another.
Question 1: What is your hacker handle?
A1: Zero Cool, A2: Crash Override, A3: Acid Burn, A4: Cereal Killer (select one)
Question 2: Which of these systems do you have control over? (Circle all that apply.)
A1: National Electric Grid A2: Local Electric Grid A3: Any Television Station A4: Any Cellphone Tower A5: Any Satellite A6: Your neighbor's wireless router
Libraries will help you with the DOM, but not a ton. They won't help you with the js.
I suggest you start with a library, but make sure you understan what you're doing in terms of the DOM.