Web App or Web Site?

June 4th, 2012 by Mike Wilcox

When Twitter went to an all-AJAX UI, I cheered that, especially the first real use of AJAX SEO, but I also questioned it. As a front end developer it was great for me to point to as an example of what could be done now and in the future. But I honestly didn’t understand why Twitter did that, since I don’t see Twitter as a web application — it’s content, like a newspaper, and really should be delivered by server.



Twitter has recently announced they are killing their AJAX-heavy UI, and rolling back to a server-centric design. The reason they cite is “time to first Tweet”. With their AJAX UI, the page would need to load, the JavaScript would need to load, execute, examine the URL, request data and wait for it, then finally render the Tweet list. They estimate it took almsot 5 times longer to get to the first Tweet with AJAX as opposed to served HTML. Twitter built a web app, when they really should have built a web site.

In my perspective, there are two basic designs for web development:

Web apps

  • Gmail or Google maps would be the prime examples. Google Search would now be considered an app as well.
  • They should be AJAX heavy, and a single page, because you don’t want to continually reload the JavaScript.
  • The server is used only for data and provides APIs. While that API may return JSON, it really should return anything that the client requests. If the client wants a comma delineated list, the server should be able to convert its output on demand.
  • Typically, web apps do not use SEO and do not have ads.
  • You can make ads work on an ajaxified page, but this may require some extra knowledge on how the ad network accepts requests, and then you may need to hack the embed code they provide. Google Search can do it because they control the ads. In other words, it’s something that really needs to be considered before you build it.

Web sites

  • A blog or a news site would be an example
  • Should be server heavy and serve pages for SEO and ads, and should be JS light, since that JS needs to load on every new page.
  • Don’t confuse an AJAX-heavy web app with a web site that has a lot of (or too much) JavaScript.
  • Needs to be read by both a browser and search engine crawler. Even though Google claims to be crawling JavaScript, the content needs to be available without it.

There are variations of the two, like Facebook, which has a lot of pages and is AJAX-heavy.

Considerations

Sometimes the decision is not so easy though. You may have ideological developers to contend with. These developers could be over zealous JavaScript crazy freaks who want to build the entire site dynamically with JavaScript. But often the ideology originates from CS graduates who have been “doing it this way” for 15 years and see no reason to change — or don’t know why they should.

A web app should be a single page for a reason. The back end should focus on data, business logic, and workflow. If it’s a complex UI that can put a significant burden on their code. What if there are tabs within tabs? Don’t forget to maintain the browser history. That Back button needs to work.

Web apps can also get too large. I worked on an app with 3 megabytes of JavaScript, which probably should have been broken into a couple of pages. The code did lazy load, but when it was all loaded you were using a lot of memory.

When Club AJAX was first launched, it used AJAX to load the pages. This didn’t work very well for SEO, and there was no easy way to include ads (not that I ever wanted ads… Bob!). The site also wasn’t easily expandable. For all its warts, WordPress, with discrete pages, was really the way to go.

Finally, it’s a very small segment of users, but some do turn their JavaScript off. This would pretty much eliminate any shopping site from being a web app, unless you can justify turning away a small percent of revenue. But JavaScript is always turned on by default, so those users know how to turn it back on. If it’s a very interactive site, like maybe with dynamic charts, it could cost you more to accomodate those users.

Conclusion

While there are two primary architecture styles, web app and web site, most projects are a hybrid of the two. Even the current version of Twitter pushes the initial set of Tweets to the page in the markup and provides the rest via AJAX. And it’s rare today to find a web site that does not have some degree of JavaScript, and often enough to consider it an “app”. Ad networks and SEO are both evolving too, so there are increasingly fewer reasons a web app can’t do it all.

Web development is evolving to be more client-side oriented. But even in cases of server-heavy sites, the front end developer needs to be more involved in the design and architecture. They tend to bring a more user-focused point of view to the project while back end devs tend to bring a more data-centric point of view.

Comments are closed.