|
Best Practices in ASP.NET 2.0/3.5: Defending Yourself From Worst Practices
Level:
Intermediate
Track:
n/a
Starts:
Apr 6 2008 9:00 AM
Ends:
Apr 6 2008 10:15 AM
Room:
MPR A
Speaker:
Richard Hale Shaw
The Question is: if brought before a jury of your peers and accused of following Best Practices while programming ASP.NET, would there be enough evidence to convict you?
While I could make a strong case that if you just used a little common sense, the evidence would be plentiful, I'm not sure I can say the same for ASP.NET itself.
Where other parts of .NET at least don't get in your way when you try to build a rock-solid, extensible, maintainable application built from re-usable components -- and some parts of .NET seem to really encourage doing the right thing -- ASP.NET seems to be chock-full of the worst possible ways of solving problems -- or at least it seems to encourage or conspire to get you to implement solutions in the worst possible way. It's almost as if the technology itself were designed and written with an expectation that fragility would be the watchword of the day. So in this talk, an admittedly hostile- to-ASP.NET developer -- who maintains and extends his own sites with it, and wouldn't turn back to ASP or JSP or raw HTML -- talks about some defensive coding practices he's developed over the last 6 years of web programming with ASP.NET.
We'll start with Strings. In ASP.NET, they're used all over the place for a variety of entities: file names, page and control names, paths and URLs, etc. The problem is that they're not type-safe (they always compile) and you can easily mistype them. What if you accidentally redirect to an .ASPX who's filename has changed? What if someone decides that "Default.aspx" is no longer going to be the default page of the site? Then we'll move to the problems of programming with Cassini, the built-in web server that is so much easier to use than IIS -- or is it? Next, we'll look at page-redirects and dynamic Control loading: what if a control is moved or re-named? And how do you work with Session State is a sane fashion?
And when it comes to Web Forms and User Controls, “re-usability” is treated like a four-le
|