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.

Source: Internet
Author: User

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

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.