I have spoken about this many times at our workshops, Devcons, etc. And written about it even more, you might say its a bit of a soap box 🙂
But as we have more and more new WebDev developers joining the ranks everyday, I bears revisiting. There are two primary methods of developing WebDev sites. WebDev Dynamic and AWP. There are other types of sites you can use WebDev for, but for interactive, data driven web applications, those are the two that we concern ourself with, and I really think if you are using WebDev to develop static HTML sites, you just might be using the Space Shuttle to go pickup milk and eggs!!
The type of web applications most of us develop (backend business applications) are very suited to WebDev Dynamic.
The main difference is WebDev Dynamic is keeping track of the “session” for you as a use move through the site, from a development stand point it is very similar to developing an EXE.
On the other hand AWP, is stateless. Browser request something from the server (page), the server sends it and then forgets anything about it. So the next request from the browser, everything has to be reestablished (DB connection, global variables, etc.) There are tools and functions within WebDev to help you manage it, but you basically have to take charge of everything yourself.
My general rule of thumb is that developing an AWP site takes about 30% more effort than an WebDev dynamic site. And therefore unless you have a business need for AWP, you should develop with WebDev Dynamic.
What are those business needs? SEO (search engine optimization) and resources.
SEO: A webdev dynamic site is sort of like an executable, web crawlers (man did I just date myself) like google, can’t index all the pages of your site. So if your site is primarily a shopping site, where you have 100’s of products and you want all of them to popup in google searches then you need AWP.
Resources: With WebDev Dynamic each session is managed for you by the server, so all global variables, connections, etc. are help (just like an running exe), until the session terminates (via timeout, user closing the browser doesn’t do that immediately), the default is 20 minutes. So think of it as if your program was a windows exe, and every visitor to your site is running a copy of the exe on your server. And for 20 minutes after they quite, that exe continues to run. Think what that does to the resources of your server, especially memory. There are ways to mitigate some of this, like decreasing the timeout, being intelligent with what you declare globally, etc. I don’t really even consider it an issue (with a decent server) until you have 50 simultaneous users. Meaning actively working on the machine at the site at the same time. And to some extent you can through money at that problem by increasing memory, although in today’s world of VM’s memory is one of the most expensive resources. You can also do some tricks with load balancing and have multiple WebDev servers hosting the same application, all talking to a single database server. So unless you are really going to have a ton of simultaneous users, I really think that WebDev dynamic is the way to go and the cost of hardware resources is going to be much less than the cost of development resources for AWP.
There is yet another possibility, and one that I use often, and that is to combine both into a hybrid site. Often with business applications, we only need a few pages to be SEO (think marketing pages), so I do those as AWP, but once you log into the backend system, you move over the the WebDev dynamic site.
So long story short, unless you are building the next Amazon, or have a very clear business need and understanding of why you need AWP, then WebDev dynamic should be your development method by default.