Once the program finds that the write is not ideal, it needs to be reconstructed, and it finds that the write is not ideal for refactoring.
In the morning, I wrote an article titled design patterns-Builder patterns: http://www.cnblogs.com/insus/p/4259620.html. Is the application and demonstration design pattern (Builder) in the ASP. NET environment ). Now Insus. NET downloads the source program from the last download link in the blog. It is not ideal for writing, and now it is reconstructed.
Problem: there is only one PlaceHolder container on the webpage. Not all generated parts can be generated in one container. Instead, they can be located in a few places, either left or right. The PlaceHolader Id varies with the web page.
Another problem is the part name: _ PageParts ["header"], _ PageParts ["content"], _ PageParts ["footer"], and so on. During development, it appears in two categories. It may be spelled out incorrectly.
To address these two major problems, Insus. NET decided to refactor these programs. Uniform part name:
Refactor the WebPage class:
Refactoring specific classes NewsPages:
ArticlePages:
Xxx. aspx. cs:
And:
In the future, we only need to develop user controls and webpages. Some classes do not need to be modified. Achieve dynamic loading and convenient maintenance.
Source program:
Http://download.cnblogs.com/insus/Refactoring/builder_refactoring.rar