Asp.net advanced tutorial (I) -asp.net or asp +

Source: Internet
Author: User

You may laugh when you see this title. In alpha, MS calls it asp +, and later the beta1 version is renamed asp.net. Isn't that the same thing? You are wrong. This is not just a simple question of what it is, but a question of what it is. I'm afraid you have read many articles about what asp.net is, and have your own understanding of it. However, most people may not understand it correctly. A simple question: what is the relationship between asp.net and asp? I'm afraid the opinions of chinaasp. net moderators represent the understanding of most people: asp + is a little bit more than asp :). Is that true? Let's take a look at the example below. This Code is the submit button of the user registration module of my own asp.net BBS. It is used to save the data submitted by the user to the database.

// Click the submit button
Public void OnSubmit (Object sender, EventArgs e)
{
If (Page. IsValid)
{
// Data warehouse receiving
Try
{
BBSUser myUser = new BBSUser ();
If (! MyUser. GetUser (txtUserName. Text ))
{
MyUser. CreateUser (BBSUser. CreateType. Create, txtUserName. Text, txtPassword. Text,
TxtEmail. Text, txtHomepage. Text ,"");
}
}
Catch (Exception exp)
{
# If DEBUG
Response. Write ("exception:" + exp. Message );
Return;
# Endif // DEBUG
Server. Transfer ("error. aspx ");
}
}
}

How is it different from asp that you used to use? In the code, you can't see the data warehouse receiving, but all the data is encapsulated into the CreateUser method of the BBSUser class. Maybe you can say that asp is okay. Isn't it enough to create a function or process? Yes, indeed, asp.net can also directly make it into a process and then call it, but if that is the case, it will be a little more than asp. Let's start from scratch.

The biggest difference between asp.net and asp is the conversion of programming thinking, not just the enhancement of functions. Asp uses html, a mix of scripting languages such as vbs and js, and those scripting languages are weak-type and Structure-oriented programming languages, rather than object-oriented, this obviously produces the following problems:
1. Code logic is chaotic and difficult to manage: Because asp is a mixed html programming language, it is hard to see the logic relationship of the code, and as the complexity of the Program increases, it makes code management very difficult, and even exceeds the management capability that a programmer can achieve, resulting in errors or such problems.
2. Poor code reusability: Because the code is structured-oriented and mixed with html, you may need to modify the page prototype and the entire program, not to mention code reuse.
3. potential errors caused by weak data types: although it is easier to use a weak data type programming language, the chance of errors is far from worth the candle.
The above is the weakness of the language itself. asp also has problems in terms of functions. The first is that the functions are too weak, and some underlying operations can only be done through components. This is far inferior to php/jsp, the second is the lack of complete Error Correction/debugging functions, which is similar to asp/php/jsp. So what improvements does asp.net have?
Asp.net is free from the disadvantages of asp's scripting language. In theory, any programming language, including c ++, vb, and js, can be used. Of course, the most suitable programming language is ms. net frmaework c # (read csharp), which can be seen as a mixture of vc and java, although ms itself speaks c # kernel more like vc, but I still think it is more like java. First, it is an object-oriented programming language, rather than a script, so it has all the features of object-oriented programming language, such as encapsulation, inheritance, polymorphism, etc, this solves the vulnerabilities of asp just mentioned. Encapsulation makes the code logic clear and easy to manage, and Application to asp.net can separate the business logic from the html page, so no matter how the page prototype changes, business Logic Code does not need to be modified. Inheritance and polymorphism greatly improve code reusability. You can inherit existing objects to maximize your investment. C # provides a complete debugging/error correction system like c ++ and java. Well, I have explained all these theoretical things in one breath. It is better to use an instance to describe the development of asp.net in the future, the complete source code for this forum and the Forum itself you can find on my site (http://bigeagle.wotoo.com ).
By the way, it should be noted that this tutorial is not an introduction to asp.net. I suppose you have some knowledge about asp.net, c #, and object-oriented programming. If not, read related articles or tutorials first.


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.