In most other situations though, where you have applications that are not simple, do not have some requirement that really benefits from not reloading pages (e.g. are not playing audio), you are not Google, the additional complexity this approach carries with it is really not worth it.
For example lets take a shopping cart, in the page post model you would submit the page to the server, create a cart in the session (bad, bad, bad) and then respond to the client with a new UI, the client would select an item, you would form post that item and the server would update the cart with the item. Back comes the UI and we do it over again with another item, ad nauseum. Eventually the user selects check out, we form post and hit a routine that tallies everything up and spits back another UI. We do this until all the data is collected to complete the transaction.
With the new model, The UI is the sole domain of the client and we speak to the server in complete representative state when we have the whole communication. Not only that but data definitions have very ridged walls that define what that data is, therefore making the server side code far more reusable (more on that in a minute).
So for this example, done the new way, JavaScript creates an order object, it then displays the UI for products after making an asynchronous call to get the product information (given that this is a defined call to the /products URL we can set a cache expiration in the future and therefore any subsequent calls have very little cost associated with them).
So now the server is acting as a data and business logic layer, while the client is providing the work-flow and the screens.
Back to the example, on the client side we have an order object, loaded with products that we have not had to make transitions to the server to create and update, we can then push this object to the server via a POST to the /orders service.
As you can see your data and business logic are becoming very defined and resource-able. If you decide to provide a mobile interface you already have the services available to support it, your data is no longer intertwined with UI work-flow.
The benefits of this model are vast but at a high level here are the big ones:
The client side becomes responsible for the work flow. So different UI's can provide optimized work-flows for their format. Web, Mobile, voice, do not have to rely on the same work-flows to reuse existing code and not start over.
Front end developers work in pure HTML, CSS and JavaScript there is no reliance on back end technologies to be able to perform their tasks.
Back end developers work in pure platforms, a Java developer works in Java, a .NET developer works in C#.
The front end and back end are loosely coupled through service calls, either can be swapped out without ramifications to the opposing side.
You data and business logic becomes addressable, a natural byproduct is that you can expose your system to third party consumers and alternative UI's.
You are working with a non-fragmented object model, one party is responsible for state and that is the client.
The front end is far more responsive to user input. You have far more opportunity to pre-fetch data based on user patterns and expectations. You have fine grain control over performance.
UI's are best programmed via an event based model. It is impossible to achieve this within the old page post model. (See the Node.js talk on blocking vs no-blocking, this is a relative of that argument).
Session management is offloaded to the client, reducing large amounts of memory and resource requirements on the server side. No longer does the server have to approximate what is happening on the client side.
A byproduct of the client holding session is that any disruption in communication does not reflect a total failure of the transaction. The client holds state and therefore can submit to the server once it become available again, no matter the point in work flow.
The decoupling of the server side allows the UI teams to develop the front end in a far more agile and rapid fashion. They can hold closer to the stake holder and rapidly modify the application to meet user needs.
If a top down approach is used, the entire front end can be prototyped while creating stub service files, allowing the stakeholder the ability to touch and feel the application before back end development begins. This significantly reduces the costs associated with development to get to the point where end users touch and request rework to the application. Further, the stubbed services provide a clean definition of the services required to the back end team.
I could write a book on the pros of this development methodology but sufficient to say, with JavaScript frameworks and proper architecture, writing new style web apps is far less cumbersome and a lot less convoluted. I was one of the nay-sayers until I tried it and actually found that it was easier and produced a superior user experience. The benefits to building apps this way are numerous.
>> create a cart in the session (bad, bad, bad)
Sorry to be a total n00b, but why is it bad to keep the cart in a session? What do you suggest as an alternative?
For example the majority of what you're describing as benefits has been known to anyone using MVC for a while, MVC is available in any of the languages you mentioned as your system being easier than.
Sure, if you try to do this manually, it's complex, but if you use a tool like NOLOH, there are others, it becomes very simple, and even more natural than conventional web development.
It's so frustrating reading these comments as if the tools don't exist today. They do, and they have. Every year or so I'll read another post that re-hashes a small part of something that an existing framework, like NOLOH, does, and it'll be touted as the way forward.
We should be able use the tools that are available, there's no need to re-create the wheel every few months, or start over. If the cool kids in SV aren't using a tool, that doesn't mean that it doesn't exist. It simply means that the cool kids aren't using it. Likely because those cool kids like to re-create the wheel, over and over and over again.
Sorry for the rant. This sort of stuff gets very frustrating.
i just love it when competitors hide their web sites behind 'romulan cloaking devices' that make their content invisible to search engines!
more traffic for me!
bwa ha ha ha ha ha!
That being said, if you follow google's rules as specified here - http://code.google.com/web/ajaxcrawling/docs/getting-started... , it will crawl your ajax pages, no problem.
Finally, please be a little civil. Thanks.
As with AJAX, the typical philosophy is to design for elegant degradation -- plan the site, then build it to work without JS, then add in the "fancy" stuff.
I agree that GWT is not friendly to UI people who are used to writing their own markup. But I would argue that a good UX person should be concerned with how the user interacts with the application (not necessarily by writing HTML and CSS by hand, but by sketching out the design on paper or Illustrator), and a framework like GWT often makes it simple to build complex UIs that would be difficult/labor-intensive to create and maintain with a traditional web dev stack. A decent developer should be capable of taking mockups from a designer and building out the rounded corners and other pretty bits himself in CSS.
Indeed, we originally had this idea back in 2004 (pre-AJAX craze), which led to the creation of NOLOH (http://www.noloh.com), available to the public since 2009 (commercial since 2005, public beta in 2008).
NOLOH allows you to create your website/WebApp in a single tier and then NOLOH will output your application in a "single page". Furthermore, it takes care of bookmarking, back button, and rendering to search engines transparently to the developer. No additional pages necessary. It also handles all the client-server communication allowing your application to be consistently lightweight and on-demand.
It was very interesting reading this, as the beginning matches closely with certain portions of our original business plan. Ahh, nostalgia.
Disclaimer: I'm a co-founder of NOLOH
If you would be so kind, could you please tell us what sort of resources were you looking for, and where you were expecting to find them? Thanks.
That said, it is very possible, but it requires that you bend your design to fit the model.
2007: I "single-paged" subsections of my application, with different PHP scripts on the backend.
2008: Consolidated the backend into a single API.
2009: Switched the backend to Rails for ORM functionality, and finished upgrading the client interface to a single page application.
2009: Switched the backend to Javascript (Rhino) to enable sharing of model validations and other code (even native object extensions) with the client.
2009: Got my application working completely offline using a local SQL database and replication manager, together with ApplicationCache. At first I used LocalStorage but soon hit storage and performance limits.
2009: Switched from Rhino to NodeJS. Much faster, cleaner APIs. Huge performance gains from V8 and non-blocking IO.
2010: Results of the above up at: https://szpil.com
Along the way I built up a framework for managing concatenation, client-side navigation, sessions, views, controllers, email etc. One significant advantage of building client-side only apps that replicate with the server is that they work offline by definition. Managing state on the client opens up incredible opportunities.
It's a fantastic little library that gives you the ability to add what I can only describe as 'rails-style' routes to your client side .js apps. It makes your single page apps much easier to write and has a good event-handling model too.
You end up with more responsive user interface but my feeling at this point is there is still a real cost of additional code complexity -- especially for larger apps.
https://developer.mozilla.org/en/DOM/Manipulating_the_browse...
Right now, I still tend to favor page based web applications with some client side code (Ajax, probably jQuery).
Sorry to punt to someone else's words here, but I think DHH summed it up pretty well, so I'll just give a link and a quote:
http://bigthink.com/ideas/21596
<excerpt>
Question: The trend now is towards client-side applications, but Rails deals primarily with server code. Does Rails need to evolve to keep up?
David Hansson: So Rails have actually been interested in the client side for a long time. When AJAX sort of first got its initial push, when it got its acronym, back in, I think, 2006, Rails was one of the first server-side frameworks that said, "This is going to be huge and we're going to do something about that." So we put a Java script library straight in the Rails distribution prototype and we built a bunch of helpers around that to make it easier to create AJAX applications with Rails. And today it's almost inconceivable that you'll build a new, modern web application that doesn't have some aspect of AJAX in it.
Now, some people go a lot further than just having some aspects of AJAX in it. Some people have their entire application in Java script and just use the back end as a data store for that. I don't find that development experience that pleasurable. I have come to tolerate Java script now that there are great libraries and frameworks like Prototype around it to sort of make it a little more pleasurable, but it's still no Ruby. Ruby is still my first love in terms of programming languages. And however much you paint up Java script, it's not going to beat that. Which is fine.
So, from the development side of things, I don't enjoy Java script programming nearly as much or in the same league as I enjoy Ruby programming. Okay, fine. On the client side of things, like is this better for the user? I think there's something special and appealing to me about the mix, the mix of how the web is discreet pages and you use hyperlinks to jump from place to place and AJAX is sort of sprinkled across to make certain common operations a little faster. I tend not to like very heavy, single-screen-based web applications. They can be fine for some things, but I think the Web has this unique category of applications that fit into that sort of middle ground between one screen, or mainly one-screen applications and static web pages. And that's an awesome sweet spot and I think it works incredibly well for a wide array of applications. And I wouldn't want them to be any different. There are certainly some people developing for the web who long for the days of the desktop application and finally see that now AJAX is bringing that back. Well, we've heard that story a lot of times. First it was Java that was going to do this, applets were going to bring back the desktop experience and we could get rid of this nasty HTML. Then it was Flash that would bring this forward. And now AJAX or anything else like that. There's been so many attempts to bring the desktop to the web, and none of them have succeeded in becoming the dominant approach to building web applications, and I think there's a good reason for that, because that's not what users want. Like that sweet spot in the middle is great and it's actually desirable on its own terms.
</excerpt>
For now, I'm pretty happy in that middle ground as well... though it will be interesting to see where this goes next.