As time to market is becoming important factor; we the developers usually get very low time to make things the right way. We have to rely on frameworks, runtimes and libraries to do the heavy lifting. While designing the app in such scenarios you have to do certain trade offs; at the end of the day; you usually ends up with a code that you don’t like and you see many places for improvements. Before the next iteration begins; you should do “refactoring” so that you start the next cycle with something better.
In the current week; I am doing such “refactoring”; luckily the whole app is ASP.NET v2 based. The first thing I noticed that due to Object Data Sources; many things tends to be in ASPX / ASCX files (designer generated code) which though works great but it reduces the code maintainability. We should push as many things to code behinds and library as we can. One approach was discussed earlier as well. But reviewing all ASPX/ASCX files one by one can be tedious. I googled and found ASP Parser (it parses the ASPX/ASCX files as well) that can be very helpful library to build a tool that parse the ASPX/ASCX files sort out server controls of types Object Data Source and generate an XML/text file that can then be used to re-arrange the code to increase the maintainability. I coded such tool (which has many rough edges and is coded for the current project only) today and viola; I did almost the week work under an hour. If I get some time; I will try to generalize the tool and make it available!
You should check the parser library; it has the Document Outliner (similar to HTML/DOM Viewers) app and you can have a look at its code to learn how to use the ASP(x) parser library!