CodeBetter.Com
CodeBetter.Com
RSS 2.0 via Feedburner
           Do you Twitter? Follow us @CodeBetter

Peter's Gekko

public Blog MyNotepad : Imho { }

The page life-cycle is not just hard for developers

A recent post by Karl on the page_load event again mentioned how hard it is to fully understand the life cycle of an asp.net page. In a comment Fregas even mentions switching to PHP (or RoR) to get a better grip on it. IMHO this is running away from the core of the problem which is (still imho) the web itself. Every web page is by definition an individual request; every sense of state is an illusion. Even when the platform or the developer using it is good; it's no problem for an average user to ruin every experience.

Ways to ruin I daily have to observe at home:

  • Use the back button of the browser. Smartnavigation or no smartnavigation it's very hard for a web app to handle this right.
  • Open the page in a new window.
  • Re-open the page via the favorites.

As a result:

  • Forms filled in are blanked again
  • Shopping baskets are emptied
  • Shopping baskets containing all items twice (or more)

I guess you will recognize this. Trying to help and explain I find there is only one satisfying answer: understand the life cycle of a web-page. Which is beyond the level of any non-technical user.


Published Jan 24 2007, 07:21 AM by pvanooijen
Filed under: ,

Comments

Jeremy D. Miller said:

The WebForms/ASP.Net event pipeline is absurdly complex and it's going to be the reason that WebForms eventually gets junked in favor of something simpler.  If I ever have to do web development in .Net again I'll be trying to use MonoRail instead of WebForms.

For the back button workflow, take a look at a continuation-based web framework like Seaside.  There's stuff in the works that might make some improvements in that regard.  

# January 24, 2007 7:58 AM

Doug Mayer said:

I almost posted a comment saying the same thing to Karl's post but was pulled away before I could finish.  I agree completely... it's not something particularly easy for many people to grasp, especially junior-level developers (as <a href="http://www.sitepoint.com/blogs/2007/01/21/page_load-is-evil/" target="_blank">Wyatt said his post was intended for</a>), but a certain understanding is required to properly handle pages with more complexity.

Karl says in his post that there's no problem with adding controls during the page's OnLoad event, but as another reader pointed out, it in fact doesn't hook into the ViewState correctly which could cause problems (as it must be around when ViewState is init'd).

# January 24, 2007 8:00 AM

pvanooijen said:

Karl focused on handling one cycle. The asp.net pipeline is indeed complex and can be quite confusing. But it's powerfull as well. In the beginning it worked against me, now I'm a happy event hooker.

Other api's may offer an easier model of handling a cycle but none gets you away from my point: it's cycle after cycle after cycle. A full grasp of that is something every web-user, not just developers, needs. Especially as by far the minority of sites has a way to poperly deal with "mis"-use.

# January 24, 2007 9:08 AM

Leave a Comment

(required)  
(optional)
(required)  

Enter the numbers above:
Add
Check out Devlicio.us!