Jeffrey Palermo (.com)

Sponsors

The Lounge

News

Advertisement

Images in this post missing? We recently lost them in a site migration. We're working to restore these as you read this. Should you need an image in an emergency, please contact us at imagehelp@codebetter.com
ASP.NET apps - things of utmost importance - level 200
I've inherited an ASP.NET application that evolved as it went, and my task is jump in and continue to enhance it. In order to do that, I've found that I need to refactor it in order to sustain its development. As it is now, it will continue to be a large, unmaintainable beast. The most important thing I'm doing is taking parts that are repeated and refactoring them into controls. This app was made with aspx pages as the focal point, and I'm refactoring to focus on controls. My goal is to enable a new page to be constructed by simply adding the appropriate controls. I don't want any code in the code behind of pages except for a property setting or method call on child controls. It's a lot easier to test custom controls than it is pages. Plus, it leads to a more maintainable site. For those reading: if you aren't comfortable with custom controls, then put everything inside user controls. You will still get the benefits of reuse and encapsulation. My rule of thumb for pages is if I have to scroll to see all the markup, then it's too much, and I'm going to refactor to controls. I'm a little more relaxed with this rule for user controls because they can be reused, but I'm firm about pages. Less is more. One quick note: I'm not doing RAD (disposable) software, and I rarely use the designer, so my rules apply to a more sustainable software paradigm, but they make no sense in a RAD environment [not many things do :)].

Posted 06-27-2005 10:22 AM by Jeffrey Palermo

[Advertisement]

Comments

shebert wrote re: ASP.NET apps - things of utmost importance - level 200
on 06-28-2005 7:18 AM
Do you commonly find the need to monitor/work with UI developers to make certain they aren't duplicating code all over the place?
shebert wrote re: ASP.NET apps - things of utmost importance - level 200
on 06-28-2005 7:22 AM
oops, i hit submit too soon...

I think there's something to the notion that UI has its own 'architecture' within the system. And if it's not constantly questioned and refactored you end up unmaintainable code.



Jeffrey Palermo wrote re: ASP.NET apps - things of utmost importance - level 200
on 06-28-2005 9:11 AM
Absolutely. I came into this project with a website already in place. I'm the ASP.NET SME here now, so I now own the ASP.NET layer. If I didn't police it, then others would code how they are comfortable (and novices to ASP.NET are comfortable with something just working). There are great SQL folks, and great class library folks, but they may be clueless about ASP.NET. It's like they just instinctively fall back into procedural mode with anything that involves markup.