How to migrate to an ASP. NET programmer

Source: Internet
Author: User

Migrate data from ASP to ASP. NET programmers are certainly quite a lot. I am one of them, but I need to change from a skilled ASP programmer to a skilled ASP. NET programmers are not easy. This requires you not only to learn a lot of new things, but also to discard a lot of old things. For those who have never learned ASP, it may be easier, because they have prepared for hard work and do not need to be discarded; it is quite painful for skilled ASP programmers, because they originally hoped that their original knowledge would be smooth and easy to use ASP. NET, the result shows that the gap between reality and expectation is so big.

After discovering this gap, no one should stop and go back to ASP. NET and ASP are our goals, so we have this series of articles. In the first article of the series, we will first discuss what ASP programmers lack and what should be supplemented first. Only by supplementing this knowledge can we call ourselves ASP. NET programmer.

Web Standards/Web Standards

For Web applications, you must first understand the Web. Currently, we advocate Web Standards. The XHTML, CSS, and JavaScript involved must be understood. Many ASP programmers may already be familiar with the old-fashioned form formatting method, but this is something that should be discarded. Many articles promoting Web Standards have given a lot of disadvantages in Table formatting. I will not talk about them much. What I want to talk about is the most fatal disadvantage of not using Web Standards for ASP. NET programmers. Since MS is also closer to Web Standards, ASP. NET 2.0 is designed to be compatible with Web Standards. At this time, all controls are designed to be separated by semantics and performance. If you do not follow this separation rule to divide the work, as you and your artist take turns weaving this Web, one day this Web will end up binding you and your artist to death.

To learn the design of XHTML + CSS well, we need not only a conceptual change, but also a change in development tools. Many people cannot adapt to the design concept of Web Standards because they are still using old tools, so they always feel that designing with old ideas is more convenient and effective. Because I believe that you will be willing to accept conceptual changes only when you adapt to new tools and experience the convenience and efficiency brought by new tools.

Speaking of development tools, I assume that skilled ASP programmers can write XHTML and CSS in plain text instead of WYSIWYG editors, because the development of XHTML + CSS requires you and your artist to have such capabilities. In the past, artists were happy to face Photoshop. This is the tool they were most used to. They were able to operate accurately and visually. They may spend half of their time thinking with their eyes. However, it is no better to use CSS now. The software that can design CSS like Photoshop has not yet been born, and any modification to CSS rules will be applied to all pages, as for what elements on each page will match this CSS rule, the artist needs to remember it with his head, instead of visualization. Although it is also an option to change the CSS rules and check the preview of several pages, it is much worse than the instant preview when parameters are adjusted in Photoshop, therefore, it is very important for artists to preview their heads so that they can write good CSS.

If you want to recommend some tools, I will select Visual Studio 2005 + Expression Web Beta 1. The former is used by developers, and the latter is used by artists to design or modify Web pages.

OOP/Object-Oriented Programming

OOP can be said to be the foundation of ASP. NET. Without OOP, there will be no ASP. NET control, and there will be no major difference between ASP. NET and ASP.

Starting with the most primitive CGI, Web application developers are simply designing such a logic-generating output Response based on the input Request. In most cases, both are flat text strings, unless it is designed to upload/download files. ASP introduces the Request and Response objects, which makes the processing slightly more stereoscopic. You no longer need to manually analyze the Request text, it can help you extract the submitted Form, QueryString, Cookies, and other parameters for your use. The introduction of Session and Application objects allows you to store specific objects without understanding the details. The introduction of Server objects provides you with many useful functions.

The biggest problem encountered by ASP is that the data provided by the three-dimensional Request is flat, and the entire processing process is flat. That is to say, any step in the processing process can access any Request data item, and then output the result to the Response, which leads to a high coupling of program code. If there is a problem with the output Response, you cannot specify which part of the process should be directly responsible for it.

ASP. NET tries to solve this problem by introducing the concept of controls. Each control is an independent logical unit. It is only responsible for its internal logic and minimizes its dependence on the external environment. The control can no longer access requests and Response in the way of common ASP logic. Its capabilities should be limited:

A control should only read the data submitted by the HTML element generated by it. Otherwise, you should consider obtaining the data through the attributes of other controls rather than from the Request. Details are as follows:
◆ IPostBackDataHandler and IPostBackEventHandler are designed for the control to process HTML-related parameters and events.
◆ If the data to be obtained by the control comes from the Child control, it should be obtained through the properties of the Child control.
◆ If the data to be obtained by the control comes from an external control, you should ask the parent control or environment for help.

The HTML generated by a control should be environment-independent, that is, no matter what HTML is generated by other controls, it will not conflict with the HTML generated by the control. Details are as follows:
◆ Render is used to generate the HTML of the cost control.
◆ If the HTML to be generated by the control may cause conflicts, request the parent control or the environment for processing. For example, the most common script generation, in order to avoid multiple output of the same script, you should register the script with ClientScriptManager and let it feel the output of the script.

Of course, you can do whatever you like to violate these rules. No one requires you to do so. But by following these rules, you can be an ASP. NET programmer. Otherwise, you will be just an ASP programmer who uses the ASP. NET Framework.

To comply with these rules, you must first learn OOP well so that you can understand why and how to comply with it. Because the rules are dead, and the situations we face may be flexible and changeable, how should we choose to design a new situation? Obviously, you may not be able to find a reference from the above rules. At this time, your OOP thoughts and values will play a decisive role.

HTTP protocol

HTTP protocol is nothing to say. A skilled ASP programmer must understand it, and it may not change from the day you learned ASP. However, for ASP programmers, this is transparent, because we directly use the Request, which is not much different from directly processing the HTTP protocol. However, in ASP. NET, the Request has been hidden. You should avoid using it. At this time, you need to pay attention to the HTTP protocol. Otherwise, you do not know what happens to the underlying communication.
Summary

Although it seems that I only listed three learning points, our goal is to be proficient. Therefore, it is not easy to learn things every time you spend at least a year and a half.

The next article in this series will discuss "what to forget". If you understand "what to learn" and find that the learning progress is not satisfactory, it will prove that you have not left some burdens.

  1. Microsoft released multiple function updates for ASP. net mvc 2 preview Edition
  2. ASP. NET Server custom control security guidelines
  3. Analysis of ASP. NET programming standards and Their encoding specifications
  4. Introduction to ASP. NET sessions
  5. ASP. NET programming tool ASP. NET Web Matrix

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.