Object-Oriented ASP technology

Source: Internet
Author: User
Tags config html page advantage

History

Today's increasingly popular web applications, based on B/s structure of the software is also increasing. This is not hard to imagine, as Sun company president Scott said, "Computer is the network," with the development of Internet technology, knowledge in the world to be fully disseminated. From the 90 's very original static HTML page (now also can be seen in the old book to read the HTML3.2, with 16 Internet Explorer or Netscape Navigator illustrations, when the beautiful level of the web and now can not be compared to the present), To the complexity and lack of customization of CGI, and then the rise of WINDOWNT, there is a call Idc,ida, idq things (of course, now those things no longer exist, but the author was still in the interest of the study of them, but now can not remember anything), Then there is the ASP2.0 based on VBScript. This is when Java gradually invades the domain of Internet programming, and the Servlet and JSP appear. Other, such as PHP, Perl, and so on, to the current Microsoft's ASP.net as the core of the. NET technology, today's web development field is a blossoming, different.

Technology has appeared so much, whether it is ASP, JSP or PHP, in the early days, their programming model is nothing more than the following mode: The client to the server to submit a http/get or Http/post request, the server received this request, or request the database, Respond to the client with the results, or respond directly to a result to the client. A simple "request-response" model. The only advantage of this model is simplicity. With the advent of large Web applications, this model soon appeared inadequate. For example, it is impossible to reuse code (in Web development, where redundant code appears to be unavoidable), many pages have similar functionality and similar code, and when the requirements change, code changes are so inconvenient that it makes people very annoying. Complex business logic cannot be implemented, and a simple structure determines that the model is not capable of complex logic. And so on, so that the predecessors of web development began to consider more efficient patterns.

At this point is worth mentioning is JSP Model2, namely Smalltalk language a very common pattern: Model-view-controller. There are related professional articles about this model, and here we will not repeat them. All in all, the emergence of this pattern has changed the mindset of most web developers, making them consider B/s software at a high level of software architecture, rather than the original "streaming development". The implementation of the MVC pattern of Apache Struts, has become a developer and learning and acceptance of a new technology. (For JSP and servlet, see my translation of another article: "Servlet and JSP, best practices")

Asp. NET's launch can be said to be another progress. Code-behind Technology and Page callback and so on, regardless of its efficiency, from these technologies alone, but also to improve our web development concept of a level. The server HTML component can interact directly with C # code, and so naturally, it has to admire Microsoft's structural design.

Now let's talk about the subject of this article: ASP.

Advanced technology and easy to use technology

At present in the field of web development, almost no one optimistic about ASP. There are always people complaining about the low salary of ASP developers on CSDN. And the ASP does exist such and such a problem, the biggest problem is that it is not compiled script, all scripts are interpreted by the implementation, which makes his efficiency greatly compromised. In addition, its weakly typed variable definition reduces the difficulty of learning with his efficiency. All kinds of problems show, give up the ASP bar, not in pursuit of a down technology.

However, I do not think that an experienced web developer would say that ASP is not good, ASP is not good to learn. Now the ASP master a lot, but jsp,asp. NET master but difficult to cultivate. In the JSP version of CSDN, asked "How to configure the JSP operating environment," a number of issues, and other examples such as "character encoding", "Database Connection" in the ASP kind of basic need not consider the problem in JSP is not uncommon. Here I do not intend to compare ASP and JSP, I dare not attack JSP or say bad words jsp. From a purely technical point of view, I think, in terms of ease of use, ASP to slightly better, and in the small and medium-sized project to grasp, put aside a person or technology industry vanity, ASP than JSP grasp big. If the reader is a multi-year experience and familiar with the ASP and JSP, should not be opposed to my point of view.

However, the advantages of JSP abound. Judging from the height of the software structure, it is too good. With JavaBean technology and extended Tag Library technology, the concept of JSP is far more than it itself. Assembly is easy, high efficiency, easy to expand, easy to achieve multi-layer structure, and so on.

From the current trend of web development (or the overall software trend), the idea of component-based is becoming more and more important. The problem now is that the basic ASP features are clearly not meeting the increasingly complex needs of today, how to implement component ideas in ASP?

The most straightforward way to think about components is to use VisualBasic or visualc++ or any other programming tool in the Windows environment. Then, almost everyone will say: VC development component is the most efficient, but very slow, VB development type fastest, efficient is also good. Indeed, VB has a simple general, support COM, COM +, and other advantages, but also the development of fast, easy to debug. In this way, VB is the first choice to develop ASP components. The other thing that has to be mentioned is XML. The benefits of using XML are great, and there's not much to say here.

My basic idea is: use VB to write components, using XML to configure the application. The concept of components here is no longer the functional component of the past (for example, Safileupload, JMail, and so on), but a component that is implemented to implement a feature. Currently these components occupy most of the ASP server-side component market. ), the more is the implementation of an entity (Entity). In other words, in object-oriented ASP technology, two kinds of components are advocated: functional components and entity components.

A functional component is primarily used to implement one or a set of functions. Of course, these functions should also be organized according to object-oriented ideas. For example, a functional component named Logincontrol contains the following methods: Checklogin, Updatelogin, Loginout, and so on, the more common example is database operations. You can write a database operation as a component and invoke it in an ASP page. The entity component implements only the basic objects and their properties and methods. The most common example of an application is the user component, which may have attributes such as name, account, password, and so on. The most obvious benefit of using user components is to take advantage of cheap resources-memory to store a logically separate complex object, thereby reducing the use of expensive resources, such as database links.

The role of XML is to provide a simple configuration of the application, creating a loose link between ASP pages and components. With this connection, the application can be divided, disassembled, and assembled in a very casual and relaxed manner. The idea comes from the web.config in Struts-config.xml and asp.net in the current MVC struts.

About the VB component registration has been a big problem. Today's web apps have gone far beyond the concept of the past. Originally just do website, now can do complex application system, and not only prohibit running on ISP's virtual host, more and more applications are deployed to the enterprise's internal network. In this case, the registration of components in VB has not become a problem, in general, unless necessary, the use of a DLL in a project is sufficient. Of course, debugging in the development process may be very boring. At the end of this article, there are some tips for debugging components, and if you really want to develop web apps in this way, you can refer to them.

The following is a practical example. Because of the time, the environmental reasons, the author only runs and tests the code on his own machine, and the author does not provide the entire sample code (if the reader is familiar with ASP and VB, the code is very simple), because of the space limit, the following example is just a simple development prototype. More factors need to be considered in the actual system use.

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.