Wednesday, November 2nd, 2005
Joe Walker has written up his thoughts on Single-page vs. Multi-page design of Ajax applications.
He discusses why he thinks that:
- Multi-page is easier
- Multi-page can give a faster initial download
- Single-page gives you advanced history
- Single-page offers faster rendering
- Single-page makes it easier to share components
It’s probably fairly obvious from this that there is no one correct answer. The best route for you will depend on what you are trying to do.
I’ve painted it a bit of an all or nothing so far – one page or many. In reality there is often a reduced-page option that keeps the advantages of automatic history and bookmarking, but adds some of the advantages of a single page design.
Depending on how you code, it might be possible to change make changes in direction during development, so it is a good idea to make sure your HTML ids are unique across your entire web application. I have taken to giving each section of my web apps a name to prefix HTML ids to help keeping things unique.
I’ve recently taken a 74 page JSP application and turned it into a single page DWR application. This has been a very interesting process. The result is surprisingly small â€“ 450 lines of HTML and 200 of CSS â€“ this isn’t the behemoth that you might expect.
If I were to start again I would probably consider 3 or 4 page design more carefully. This would create a simple solution to the back button and book-marking issues without needing support from RSH or Dojo.
In summary – there is no “correct” answer, but more of an it-depends. Single-page is harder, but can give better results.
Most of the Ajax designs coming out of Google (GMail, Reader, Maps), Yahoo (Oddpost), and Microsoft (Kahuna, Start) are single page. Others are reduced page (Writely.com for example), which suggests that they are putting the effort into a more user-friendly design.
Posted by Dion Almaer at 8:46 am