System architecture design notes (80)-.NET

Based on a set of open Internet protocols, the Microsoft .NET strategy has launched a series of products, technologies, and services, sounding the clarion call for Internet technology changes. Regarding .NET, Microsoft CEO Ballmer described it this way: "Microsoft .NET represents a collection, an environment, and a programmable structure that can be used as a platform to support the next generation of the Internet." This sentence briefly summarizes .NET. External characteristics.

1 .NET platform

.NET is an environment first. This is an idealized future Internet environment. Microsoft's vision is to "no longer pay attention to a network environment where a single website and a single device is connected to the Internet, but to let all computer groups, related equipment and service providers work together" Computing environment. In short, the services provided by the Internet must be able to complete a higher degree of automation.

In the future, the Internet should be presented to end users in the form of an overall service. Users only need to know what they want instead of searching and operating the Internet step by step to achieve their goals. To build such an Internet environment, the first problem that needs to be solved is to design and create a new generation of Internet structure based on the defects of the existing Internet. This structure is not a topological structure at the physical network level, but a programmable Internet software structure oriented to the software and application level, which is different from the browser that can only be statically browsed. Therefore, .NET positions itself as a programmable structure that can be used as a platform to support the next generation of the Internet.

The ultimate goal of .NET is to allow users to access the information, files and programs they need anywhere, anytime, and using any device. The user does not need to know where these things exist, or even the specific details such as how to obtain them. They only need to make a request, and then only be responsible for receiving it, and all the background complexity is completely shielded. Therefore, for enterprise IT personnel, the workload will be greatly reduced, and they do not need to manage complex platforms and understand how the work is coordinated between various distributed applications. .NET includes 4 important features: one is software to become a service, the other is a common language based on XML, the third is the integration of multiple devices and platforms, and the fourth is a new generation of man-machine interface. These 4 characteristics basically cover the technical characteristics of .NET.

(1) Software change service

When talking about software services, Ballmer said: "Today's software products are just a compact disc. Users purchase software, install, manage and maintain themselves. But software services are services from the Internet, which install, update and track for users. These software, and let them and users roam between different machines. It stores their own information and reference materials for users. These are the different styles of software and software services." This passage summarizes the core of software-to-service. With the rise of the ASP (application service provision) industry, software is gradually transforming from a product form to a service form, which is the overall trend of the IT industry.

In .NET, the final software application appears in the form of Web services and is published on the Internet. Web service is a packaged component that can be published on the Web. .NET describes and publishes this Web service information through the WSDL protocol, finds related services through the DISCO protocol, and performs related simple objects through the SOAP protocol Pass and call. As shown in Figure 1, the Orchestration visual programming tool in the .NET platform is used to generate XML-based XLANG code. It and the Biz Talk server, .NET framework, and Visual Studio .NET have all been important parts of the Windows D2000 strategy.

Microsoft's .NET strategy means that Microsoft and developers on the Microsoft platform will manufacture services, not software. In the next few years, Microsoft will successively release platforms and tools related to .NET and develop Web services on the Internet. At that time, users, developers, and IT staff working on .NET stopped buying, installing, and maintaining software. Instead, they will customize the service, the software will be installed automatically, and all maintenance and upgrades will be carried out via the Internet.

(2) A common language based on XML.

XML is a markup language evolved from the SGML language. As a metalanguage, it can define data exchange languages ​​for different kinds of applications. In the .NET architecture, XML is used as a means of seamless connection between applications, used for data collection and merging between multiple applications, and used for interoperability and collaborative work between different applications. Specifically, .NET defines the Simple Object Access Protocol (Simple Object Access Protocol, SOAP), Web Services Description Language (WSDL), and Web service discovery protocol through the XML language. The SOAP protocol provides a simple and lightweight mechanism for exchanging structured and typed data using XML in a decentralized environment. The WSDL protocol defines the structure of the service description document, such as type, message, port type, port and service itself. The Web Service Discovery Protocol defines how to extract service description documents and related service discovery algorithms from resources or resource collections.

(3) Integration of multiple devices and platforms

As the Internet has gradually become a center of information and data, various devices and services have been or are being connected to and integrated into the Internet and are trying to become a part of it. .NET seeks to integrate with various Internet access devices and platforms, mainly focusing on wireless devices and home network devices and related software and platforms.

(4) A new generation of man-machine interface

The new generation of man-machine interface is mainly embodied in two aspects of "intelligence and interaction". .NET includes input and expression methods through various modes of natural speech, vision, handwriting, etc.; XML-based editable composite information architecture-general canvas; personalized information agency services; enabling machines to better automate processing Smart tags and other technologies.

The .NET platform and framework are based on another upgrade and evolution of the Microsoft software industry foundation. However, .NET still has to do its best to ensure that the Windows system and series of products can be integrated with .NET, and try to make .NET continue to become the center of the Internet on the basis of Microsoft's original software assets.

2 .NET Framework

The Microsoft .NET development framework is shown in Figure 2. The universal language runtime and a set of basic class libraries it provides are the foundation of the entire development framework; in terms of development technology, .NET provides a new database access technology ADO.NET, as well as network application development technology ASP.NET and Windows programming Technology Win Forms; In terms of development language, .NET provides VB, VC++, C# and other languages ​​support; while Visual Studio .NET is a development tool that fully supports .NET.

2.1 Universal language runtime

Microsoft.NET brings a brand new development framework to developers, and Common Language Runtime (C ommon Language Runtime, C LR) is at the bottom of this framework and is the foundation of this framework. Readers may already understand the concepts of the so-called C runtime, VB runtime, and Java virtual machine, while the common language runtime provides a unified runtime environment for multiple languages.

In addition, it also provides more functions and features, for example, a unified and simplified programming model, users do not need to be confused by Win32API and C OM; it avoids DLL version and update issues, which greatly simplifies application release and upgrade ; Interaction between multiple languages, for example, classes written in C++ can even be used in VB; automatic memory and resource management, etc.

Microsoft.NET is based on the common language runtime, which realizes the functions that these developers dream of. The code developed based on the universal language runtime is called controlled code. Its running steps are roughly as follows: first use a programming language supported by the universal language runtime to write the source code, and then use the compiler for the universal language runtime to generate independent The machine's Microsoft Intermediate Language (MIL), and at the same time, generates metadata required for operation, and then uses the Just In Time Compiler (JITC) to generate the corresponding machine code for execution while the code is running.

2.2 Basic Class Library

Of course, for developers, in addition to the new features provided by the common language runtime, they also care about what programming interface it provides to developers. This is the Base Class Library. This set of basic class libraries includes everything from input and output to data access, and provides a unified object-oriented, hierarchical, and extensible programming interface. It uses a dot-separated method that makes it very easy to find and use class libraries. For example, the root of the basic class library, its namespace is System, and the namespace of the class library that provides data access is System.Data. When using it, developers only need to add a reference to the required basic class library in their own applications, and then they can use all the methods, properties, etc. in this class library. Compared with traditional Windows programming, it is very easy to use and extend the basic class library, which enables developers to efficiently and quickly build network applications based on the next generation of Internet.

2.3 ADO.NET

Almost all applications need to access various types of data, from simple text files to large relational databases. The technology to access the database in Microsoft.NET is ADO.NET.

ADO.NET provides a set of class libraries for connecting to the database, running commands, and returning recordsets. Compared with the previous ADO (Active Xata Object), Connection and Command objects are very similar, and the innovation of ADO.NET is mainly reflected In the following aspects:

First of all, ADO.NET provides powerful support for XML, which is also a major design goal of ADO.NET. In ADO.NET, you can easily create and use XML data through XML Reader, XML Writer, XML Navigator, XML Document, etc., and support W3C's XSLT, DTD, XDR and other standards. ADO.NET's support for XML also provides a foundation for XML to become a unified format for data exchange in Microsoft.NET.

Secondly, ADO.NET introduced the concept of Data Set, which is a data buffer that resides in memory and provides a relational view of data. Regardless of whether the data comes from a relational database or an XML document, people can use a unified programming model to create and use it. It replaces the original Recordset object, improves the interactivity and scalability of the program, and is especially suitable for distributed applications.

In addition, some new objects have been introduced in ADO.NET. For example, Data Reader can be used to efficiently read data and generate a read-only record set.

In short, ADO.NET makes data manipulation in Microsoft.NET very convenient and efficient through a series of new objects and programming models, and closely integrated with XML.

2.4 ASP.NET

ASP.NET is the network programming structure in Microsoft.NET, which makes it very convenient and efficient to build, run and publish network applications. You can learn about ASP.NET from the following aspects:

(1) Web form.

The design purpose of ASP.NET WEB forms is to enable developers to create Web forms very easily. It introduces the rapid development model in VB into network development, which greatly simplifies the development of network applications. Specifically: ASP.NET can support multiple languages, not only scripting languages, all languages ​​supported by the universal language runtime can be used in ASP.NET; code and content are separated, in the current ASP (Active Server Pages) During development, content and scripts are interleaved, and maintenance and upgrades are difficult. Separating them can enable developers and designers to better work together and improve development efficiency. In addition, by introducing server-side controls in ASP.NET, Rapid development similar to VB is applied to web development, which greatly improves the efficiency of constructing web forms, and the server-side controls are extensible, and developers can build the server-side controls they need.

(2) ASP.NET Web service.

Web service is the core of the next-generation programmable network. It is actually a namable network resource that can be used to conveniently express and use objects within the Internet, just like using today’s COM objects. The difference is the use and representation of the network. Services are implemented through SOAP or even HTTP. In ASP.NET, it is very convenient to build and use network services. To build a web service in ASP.NET is to write a file with a suffix of .ASMX. Add the method you want to show in this file. The builder of the web service does not need to understand the details of SOAP and XML, but only needs to focus on Focusing on your own service itself provides a good opportunity for independent software service developers; the easiest way to use network services is to use the HTTP protocol (HTTP GET or HTTP POST), and users only need to directly access the network service (. ASMX file) URL; of course, users can also use the web service in their own applications more flexibly through SOAP.

(3) ASP.NET application framework.

ASP.NET applications are no longer interpreted scripts, but compiled and run, coupled with flexible buffering technology, its performance has been fundamentally improved; because the ASP.NET application framework is based on the common language runtime, it publishes a network Application is just a process of copying files, even if it is the release of components. To update and delete web applications, you can directly replace/delete files; developers can store application configuration information in XML format files. Developers can manage application programs separately; provide more kinds of authentication and security management methods; greatly improve reliability and other aspects.

2.5 WinForms

Traditional Windows-based applications (Win Forms), it is still an indispensable part of the Microsoft .NET strategy. When developing traditional Windows-based applications in Microsoft .NET, in addition to using existing technologies such as Active X controls and rich Windows interfaces, you can also develop based on common language runtime, and you can use ADO.NET and network services. And so on, it can also realize the new features of .NET such as avoiding DLL hell and multi-language support.

2.6 Development language

From the above introduction, we already know that the Microsoft .NET development framework supports multiple languages. In the current beta version, it supports four languages: VB, C++, C# and Jscript and the deep interaction between them. Moreover, Microsoft supports third-party production of compilers and development tools for Microsoft .NET, which means that almost all programming languages ​​on the market may be applied to the Microsoft .NET development framework. In this way, developers can choose their favorite language at will. This open and interactive feature is exactly what developers love.

It needs to be pointed out that Microsoft has introduced a brand new C # language in Microsoft .NET. This brand new object-oriented language allows developers to quickly build different applications from the low-level system level to the high-level business components. While ensuring powerful functions and flexibility, C# brings rapid development similar to VB to C and C++, and it is also specially designed for .NET. For example, C# allows direct mapping of XML data For its data types, etc., the combination of these features makes C # an excellent next-generation network programming language. At the same time, Microsoft .NET has made great improvements to the original VB and C++, making them more suitable for the needs of the Microsoft .NET development framework. For example, in Visual Basic .NET, object-oriented features such as inheritance, structured error handling, etc. have been added; the manageable C++ extension greatly improves the efficiency of using C++ to develop Microsoft .NET applications.

Visual Studio .NET is closely integrated with the .NET development framework and is an excellent tool for building Internet applications. Visual Studio .NET greatly improves the efficiency of developers by providing a unified integrated development environment and tools; integrates multiple language support; simplifies server-side development; provides methods for efficiently creating and using network services.

One of the main purposes of the .NET framework is to make COM development easier. The most difficult part in the COM development process is the basic structure of COM. Therefore, in order to simplify COM development, the .NET framework actually automatically handles all tasks that are closely related to COM in the eyes of developers, including reference calculation, interface description and registration. It must be realized that this does not mean that .NET framework components are not COM components. In fact, COM developers using Visual Studio 6.0 can call .NET framework components, and in their opinion, the latter are more like COM components with iUnknown data. In contrast, .NET framework developers who use Visual Studio .NET regard COM components as .NET framework components.

In order to avoid misunderstandings, this relationship needs to be specifically explained here: COM developers must manually do most of the things that .NET framework developers can perform automatically at runtime. For example, the security module of the COM component must be handwritten, and the memory occupied by the module cannot be automatically managed. When installing the COM component, the registration entry must be placed in the Windows registry. For the .NET framework, these functions are automated at runtime. For example, the component itself is self-describing, so it can be installed without being registered in the Windows registry.

When COM is combined with Microsoft Transaction Server (MTS) and Distributed COM (D COM), it becomes COM+. COM+ provides a set of services for the middle layer. In particular, COM+ provides process management functions and database and object connection pool processing functions. In future versions, it will also provide a feature called partitioning-a more powerful process isolation feature specifically designed for application service providers. COM + services are mainly for middle-tier application development, and mainly provide reliability and scalability for large-scale distributed applications. These services are a supplement to the services provided by the .NET framework; these services can be accessed directly through the .NET framework classes.

2.7 Other features

There are several elements of the .NET framework worth mentioning. The first is its security system and configuration system. The two systems work together to effectively curb the possibility of running unsafe code and greatly reduce the challenges faced by the "DLL hell" when configuring applications.

The security system is a highly detailed, fact-based system that gives developers and administrators multiple code processing permissions (not just "on" or "off"). In the future, we will decide how to implement the above permissions based on the core elements of the code itself. For example, when a .NET framework application is downloaded to a certain system, it will apply for a set of permissions (such as write permissions to a temporary directory). The runtime will collect factual information about the application (such as: where it was downloaded from, whether it uses a valid signature, and even the accuracy of its access to the system), and decide whether to allow the application to run according to the management policy. The runtime can even inform the application that it cannot authorize all the permissions requested, and allow the application to decide whether to continue running. With this kind of security system as a guarantee, many application configuration problems will be solved.

One of the biggest challenges facing developers and administrators (and ultimately users) is version management. If everything is paralyzed after a new application is installed, and the system has been running very well before then, the most likely reason is that the newly installed application has rewritten some shared libraries and is most likely corrected. The program being used by the existing application is wrong. This situation occurs so frequently that people call it "DLL hell". Several advanced features of the .NET framework can completely eliminate the "DLL hell" phenomenon. First of all, it has a very powerful internal naming system, which can effectively prevent two libraries from being mistaken for each other due to the same name.

In addition, it also provides a new feature called "parallel" configuration. If the newly installed application in the previous example does overwrite the shared library, the existing application can repair the library. When the existing application starts again, it will check all shared files. If it finds that the file has been changed and the changes are incompatible, it can request the runtime to extract a version that it can use. Thanks to the powerful security system, the operation can be performed safely at runtime, so that the application completes its own repair work.

In short, on the basis of the common language runtime, the Microsoft.NET development framework provides developers with a complete basic class library, the next generation of database access technology ADO.NET, and network development technology ASP.NET. Developers can use a variety of Language and Visual Studio.NET to quickly build the next generation of network applications. With the popularization of relevant Internet standards and technologies, it can be predicted that more and more developers will adopt this development structure and develop rich and diverse next-generation Internet applications.


Guess you like

Origin blog.csdn.net/deniro_li/article/details/108807959