Friday, May 30, 2008

Web application design philosophy - HELP!?

Full disclosure: I started developing web apps like two days ago. This post is written as a n00b, not as a source of authority.

Not to be intimidated, I got out my slate and chalk, and began doing screenshot designs for a rich internet application (RIA) I want to write. I found myself some whizzbang technology, in this case Google Apps Engine and the Extjs javascript widget framework. They're both pretty easy to work with (so long as you don't need to do any debugging) and I managed to prototype myself some pages to do Neat Stuff.

I'm now faced with a difficult path to actually learning how to write a web application "properly". With a standalone GUI app, I'm pretty much fine with application design, breaking things up into an MVC model and then doing an object-oriented design of each bit. With a web application, it's not so clear how I should do things.

If I were designing something in static HTML, all the logic goes on the web server. The user clicks "load data" and the web server goes and produces a static HTML page showing the data loaded. The application brain is in the server, and the purpose of the HTML page is to render the user interface to the client.

It appears possible to basically do the complete opposite with javascript, and put basically all the processing logic into the javascript, treating the web server as just something to go fetch resources from.

So should the logic go?

I'm worried that if I pursue a heterogenous design, whereby the application logic is split between client and server, that I will then have an unsatisfactory level of coupling between the two. Should the database be the 'model', the web server be the 'controller' and the client be the 'view'?

Presumably, if I put heaps of logic into the javascript, then network overhead will be high but latency will be good? Whereas perhaps if I do it the other way, network overhead will be low but many more requests will be necessary, thus slowing application responsiveness?

Where do XML web services and SOAP requests come in? "Should" I be using these as an API, or should I just request data and perform my processing in javascript?

How do I write a web application such that it is reasonably 'pluggable' -- that is such that I could alter my choice of server, database or javascript extension library without killing myself?

Should I use something like Django's templating to control the GUI or should I put all the GUI design into my javascript? Should there be a javascript object representing the whole application which then loads the navbar, display and other widgets?

Should I do form processing on the web server, or in the javascript?

ARGHHH!

I think, maybe, the index page should be a trad "web page" kind of page, with links to the RIA pages.

-Tennessee