.NET development platform research (2)

zhaozj2021-02-16  50

The main benefits of class libraries is that they encapsulate the core WIN32 API's most commonly used features and plug-in SDK to a unified package. Packet and description of class libraries in clear and organized ways so that developers can easily find most of their applications.

Conversely, in the past few years, new features are either "Bound" to WIN32 API, and is provided by separate APIs (for example, DirectX for graphics, or different SDKs for XML and SOAP). The only logical grouping that can be done is to sort in alphabetical order. As a result, using WIN32 API and various SDK often make people halo, and developers must judge which one of several similar APIs is best for their specific requirements.

Support Web Services

The combination of CLR and class libraries makes it easier to develop Web Services than previously on Windows.

First, CLR provides a more reliable basis for running server applications, including Web Services. Server applications typically have higher availability and security than desktop applications, so they will benefit from CLR capture errors and block malignant code. In addition, server applications typically need to run for a long period of time, so it will also benefit from the fragmentation function of the CLR. Debris finishing features can limit memory disclosure, otherwise the application for long-term runs may exhaust all available memory.

Mix control code and unconnectable code

Collaboration features of Common Language Runtime (General Language Run Environment) allow developers to mix controllable codes with existing uncontrollable codes in COM components (and code in the Win32 Dynamic Library (DLL)).

When a control code component calls a COM component (top), the CLR generates a runtime callable wrapper (RCW). The RCW acts as a role of the agent (or mediation) of the Unconconquired COM component. RCW processes all interactions between control components and COM components, including (but not limited to) below:

· Translation and delivery between CLR and COM Environments

· When the control code component is re-declared by the CLR fragmentation process, the memory and other resources of the packaged COM components are released.

• Translate errors from COM error returns code (HRESULT value) into a CLR error (called abnormal).

When the COM component calls written with a control code (under layer), the CLR generates a package called COM to modulate packaging (CCW). Similar to RCW, CCW also acts as a proxy or intermediary between uncontrollable COM code and control code. The CCW also implements the standard settings for the functionality required for COM components, so that control code components look like standard COM components.

CCW Processing Uncontrollable COM objects and controlled .NET components include (but not limited to) the following.

· Move and translate data between two environments

• When the COM component is released, the control code for the last fragmentation is released by the CLR.

· Translate CLR to COM return code.

Second, the class library provides the developer to create Web Services or all code required to use the application of Web Services. In particular, they provide code for translational conversion between application data and XML, and code that transmits and receiving SOAP messages through the Internet protocol. This developers can put more energy on their own application logic, and try to consider how to implement a network protocol or read and write XML data.

Unified platform:

CLR and class libraries also solve an important issue in Microsoft's current platform: All programming languages ​​are not balanced. Each programming language of Microsoft has its own Run-Time infrastructure (for example, Visual Basic [VB] Runtime's multiple potential conflicts of conflicts) and a software library (such as Microsoft C basic classes). This requires Microsoft to maintain these libraries and related tools such as DEBUGGER and WIZARD. An organization usually has to split a project, some of which let C programmers, and other VB programmers will write. Any programmer's shortage will affect progress. The .NET Framework uses two methods to solve the problem of language.

Standardized data type. First, .NET Framework provides standard internal descriptions and computments for the most common data types (such as integer, real, text characters), and provides mechanisms that extend these types to all .NET language and CLR. Establish this standardized data type and scalable model (a full name .NET Framework CommON Type System (CTS), eliminating the necessary data types for each language to implement data types in its own unique and incompatible method.

Standardized application format. Secondly, .NET Framework implements a standard application format - has its own MSIL, metadata, and list of compilation. All .NET language compilers generate this format. Data that processes any source programming language can be analyzed by extracting information about MSIL from metadata.

Standardized data types and application formats enable developers to create class libraries working with any programming language that understand the data types and formats, such class libraries contain all Microsoft's .NET programming language and numerous third parties Vendor language. In particular, the .NET Framework class library uses only CTS data types and assigns standard application formats. As a result, these class libraries can be used in any .NET programming language application.

(Please refer to "Development Control Code" diagram.)

CLR and class library combined with Microsoft provides a single run platform that supports all programming languages ​​and can be implemented with a set of public development tools. Microsoft has released a specification of the platform and the language it. (Please see "ECMA Standards and Windows Lock-in.) In addition, the class library provides roughly the same basic functional group to all .NET programming languages, so that the programmer can use any of their most hands-looking language. .

.NET class library domain name space

The API provided by the .NET development platform is organized to arrange a group of grading domain names with logical names. (This picture is intended to show a few more important classes.) This is a sharp contrast with the Win32 API. Win32 API is just a simple list of function names, and the top can be sorted by alphabet. After the grading system, the developer can be more quickly positioned, and the added new API will not conflict with the existing.

The class is built on the base class (underlying), the basic class has the ability to follow the ability of text processing (System.Text) Network Access (System .NET), and the storage list and other datasets (System .collections).

The basic class is a more complex class, such as data access (System .data), which includes add.net and XML processing (System .xml).

The top layer is a user interface library. The Windows form and Drawing library (System.win form and system .drawing) provide packaged Windows user interface, including GDI and DirectX .system. The Web contains class libraries for establishing an ASP.NET application including a Web Services class and a web form user interface class. Develop control code

Developers created controllable code by combining their own application source code and code from the .NET class library. These class libraries may include .NET development platform, class libraries (such as ADO.NET and Windows forms), as well as class libraries from third parties.

Next .NET compiler translates this code from people to readable format into Microsoft Intermediate Language (MSIL). Regardless of the language, all .NET development platform compilers generate MSIL results.

In addition to the MSIL, .NET compiler also generates metadata, it describes the components that make up the code. CommON Language Runtime (CLR) (Universal Language Run Environment) Use this metadata to enhance security and make sure you get the correct version of any of the components you need (reducing component conflicts, or "DLL Hell").

Visual Studio .NET and other tools automatically encapsulate MSIL code into the assembly used in the CLR. Several MSIL files can be combined into a single assembly. (For a compilation, how to perform the graphical profile executed by the CLR, see "Execute Control Code" diagram.)

6. Comparison of J2EE in 6.NET Development Platform

As an application platform that competes with each other, Microsoft's .NET development platform and Sun's Java 2 Enterprise Edition (J5EE) (Java 2 Enterprise Version) are extremely similar to the system, but at its underlying implementation is completely different.

Similar objectives:

.NET development platform and J2EE have similar objectives in spirit:

Ø Using the programming model of code components created by others to eliminate the need to rewrite the underlying routine by providing developers, eliminating the need to rewrite the underlying routine, thereby increasing the development efficiency of the developer.

Ø By eliminating or decreasing the use of the easy-to-error structure of the development language such as C, the programming model using forced interaction points between all code components (this isolates the impact of the error, and the error tracking is easier ), Enhance software reliability.

Ø Controlling the application by or nothing (for example, whether they can read / write disk), and use digital signatures when running, the code is not changed by trusted entity and has not been changed to improve security. .

Ø Simplify installation and uninstall by embedding component description (including version information) within the code itself. This eliminates the development of "registration" thinking when installing "registration" - this is a major reason for the previous installation of complex and unstable - therefore, no or very few users or administrators, The application software can be automatically installed. In the case of the .NET development platform, it also allows different versions of the same component to coexist, interfering with each other, nor interference with other applications.

Similar architecture:

Due to the objective similarity, .NET and J2EE two development platforms also have similar architectural structures. The corresponding architecture features are as follows:

Ø Virtual machine: Design it to check, load, and execute procedures in a firmly controlled "sandbox). This sandbox reduces the risk of malignant code (such as viruses) and trusted code. The hazard is reduced by malignant code (such as viruses) and trusted code. In order to enable this sandbox architecture, all procedures are compiled from the original code into intermediary language-Microsoft Intermediate Language (MSIL) or Java bit code from the processor-independent intermediary language. These intermediary code units are then translated into native code for a particular CPU type and operating system. This virtual machine also provides procedures for basic services such as memory management. The .NET's virtual machine is called Common Language Runtime (CLR), J2EE uses Java Virtual Machine (Java virtual machine). Ø Class library: Provide pre-write features to application developers, including: encoding services (such as string operations and transaction), network services (protocol processing), system management services (security licenses, and component merge), server services (For web page services, connect e-mail), and serve for external sources such as database systems and data streams.

Ø Customized programming language: It is based on C and C , including improvements such as strong types and possibilities to improve developers development efficiency and reduce BUG. However, as long as there is a compiler to translate the initial source code to become a mediation code that the virtual machine can understand, it is not necessary to write programs with these languages ​​(C # for .NET or Java for J2EE). CLR now supports C #, Visual Basic, JScript, Coblol, Fortran, Haskell, and Python (with many other languages ​​developed by triparties); JVM supports Java, Cobol, ADA, and ProLog.

Ø Development environment for dynamic web pages running on a web server: This allows developers to use the same platform to create desktop applications, and create web-based applications, .net uses ASP ... sP ... Use Java Server Pages (JSP).

7. .NET development platform tool:

Unlike the platform conversion from the Win16 to Win32 API, the conversion from Win32 to .NET development platform has both modifications to existing language and tools, it has also introduced a new language. As a result, it is decided to use the organization of the .NET development platform, which must not only change their platform strategy, but also must consider their language and tool strategy.

.NET development platform language

There will be three new version of Microsoft programming language supports CLR and Category Library: Visual Basic.Net, Visual C , and JScript.net. They will also combine two new languages: Visual C # and Visual J #. Visual J # Enables Visual J developers to create controlled code in a similar language.

Microsoft often points out that the biggest difference between .NET development platform and other programming environments such as Java is that .NET development platform supports multiple programming languages. (For more information on .NET development platform and Java, the language is seen by the border content ("" .NET development platform and J2EE comparison ".) Since the .NET development platform supports different languages, the programmer with different techniques You can use the language they are best to create, and these components can be collaborated smoothly. But this also brings a problem - how development and project managers choose the language used by their applications. Each support for each support for CIR and The language of the class library has different implementations and history, and it needs to be considered when choosing. (For a quick guide to obtain the selection .NET development language, please see the Border Content "Select the Quest Rule of Net Language".)

Visual Basic .NET

This new language has a syntax similar to existing Visual Basic (VB), designing it is to make developers using VB can transition to .NET. However, the previous VB version is different, Visual Basic.NET replaces similar VB components and plugins using the CLR and class libraries. VB.NET also has new, advanced features, such as support for multi-threaded and structured exception processing. Although the removal of language habits such as "OneRror Goto" type is a popular change - this will make the app more robust, but it means that the current VB programmer cannot load and run their previous application. .

In fact, VB.NET has a large change compared to previous VB versions, and cannot be compatible backwards. Microsoft is developing a tool for migrating the VB source code to VB.NET code, but this process cannot be complete automatically. Developers must manually check the migrated code, rewrite some parts, and carefully test the results.

However, developers don't have to migrate all code: Lai Lai CLR's collaborative function, VB.NET can call VB code, and vice versa. This allows developers to gradually migrate applications - for example, a VB.NET application can merge some existing VB modules.

Since the migration cannot be completed immediately, Microsoft promised that it will continue to support the current VB language (version 6.0), at least the third version of VB .NET release, according to the typing of the VB release, it is about five or six years later.

The variation of the two VBs cannot be migrated to the .NET development platform: a Visual Basis Scripting Edition (Visual Basic script description version) for managing scripts, Active Server Pages (ASP) The script description language of dynamic web content; the other is Visual Basic for Applications (VBA) for customizing script description languages ​​for applications such as Office. VBScript already encompasses in VB.NET, while VBA will continue to function as a macro design language in Office.

Microsoft said that when it migrates the .NET development platform, developers who have used VBs in the past should use VB.NET instead of C #. This is just a preliminary analysis, and the specific situation needs to consider the extensive extensive extensive version of the VB function used by developers:

· For most general VB programmers, most of the language changes are quite straightforward. If the main experience of VB developers is to use existing VB components, they should use VB.NET to develop new applications, and cannot go to use C #. The additional complexity of the more stringent object-oriented language like C # is not proportional to any small income.

转载请注明原文地址:https://www.9cbs.com/read-22646.html

New Post(0)