THE MICROSOFT .NET FRAMEWORK


Microsoft envisions a Next Generation Internet made up of many different kinds of devices. It sees users not only communicating and sharing data using PCs and PDAs, but also with mobile devices such as cell phones and set-top boxes such as digital movie recorders. But standing in the way of this interlinking of devices are many challenges, chief among them a common way to develop applications that work well with each other.

Microsoft has developed the .NET Framework as an answer to this challenge. Whether Express or full-featured versions, each of the various Visual Studio programming languages is designed to work with the Microsoft .NET Framework. Microsoft hopes that the .NET Framework provides a seamless standard for interoperability, the capability of applications or libraries that are written in different languages to work well with each other regardless of the platform.

Before .NET

Before the introduction of .NET, developing and releasing a product often involved dealing with a conceptual alphabet soup. Microsoft created and encouraged the use of several versions of the Component Object Model (COM), including COM+ and Distributed Component Object Model (DCOM). Using COM, Windows programmers were able to write programs more quickly by relying on a consistent and unified group of Windows services and system resources, such as data sharing and networking support. This, in turn, allowed programs to rely on Dynamic Link Libraries (DLLs), or files that a program would link to access the functionality it needed.

COM, along with Microsoft Foundation Classes (MFC), represented one of Microsoft's first attempts at creating an OOP standard for building Windows applications. MFC provided a way to build modules that utilized basic Windows functionality. COM, in turn, gave programmers the ability to create component libraries made up of code that could be reused by different languages, such as Visual C++ and Visual Basic.

Before the arrival of .NET, distributing a program often meant distributing the DLLs that gave the program the access to services it needed. A game, for instance, might need several DLLs to give it access to high-speed graphics functions. Because DLLs sometimes changed, when programmers were ready to deploy their applications, they would have to consider whether the DLL they were releasing with their product might conflict with a DLL that was already on the user's system. Things would get really complicated if DLLs depended on other DLLs to function.

Unfortunately, with thousands of different software packages and computer configurations to deal with, programmers didn't always get it right. Sometimes the DLLs they installed replaced files that were already on a user's computer with older or incompatible versions of the same files. This often caused other applications on users' computers to mysteriously break. The situation was so common and difficult to deal with that programmers, even those at Microsoft, ultimately began to refer to it as DLL Hell.

Microsoft's solution to DLL Hell was the .NET Framework. The .NET Framework is now responsible for giving Visual Studio programming languages the functionality that they used to get from DLL files. Because DLL files are not needed to develop Windows applications, deployment packages are now a lot smaller. Today, instead of worrying about what version of DLL files users have installed on their computers, programmers need only to make sure that users have the .NET Framework installed.

.NET Components

The .NET Framework is a collection of programming services that support application development and execution on Windows operating systems, the Internet, Tablet PCs, and even mobile devices such as PDAs (using the Compact Framework). The .NET Framework acts as an interface between the operating system and your applications.

Figure 1.5 depicts the .NET Framework's role in the application development process. As you can see, it enables applications to be developed using any combination of .NET-supported programming languages. It is responsible for translating the code created using these programming languages into a format that can be executed on the intended execution platform, whether it is a PC, a Web server, or a PocketPC device.

image from book
Figure 1.5: The Microsoft .NET Framework is utilized by multiple languages to build applications for several target platforms.

The .NET Framework is made up of two main components:

  • .NET Framework class library

  • Common Language Runtime (CLR)

The .NET Framework class library is composed of an enormous amount of prewritten code that is available to any Visual Studio programming language. The class libraries are used to define objects within applications.

Hint 

A class is the actual, self-contained code that comprises an object, such as a menu, a button, or a text box. When you create a new form or add a control to a form when building an application interface, you are adding new objects based on predefined classes stored in the .NET class library.

The .NET class library contains the code required to create forms, buttons, and other Visual Studio controls. For example, to create a new form within a Visual C++ application, call upon a predefined class that already has everything defined within it to create the new form. This saves you from having to write all the underlying low-level code yourself. If you then drag and drop a Button control onto the form, the .NET class library automatically supplies your application with all the underlying code, defining how the button looks and how your application can interact with it.

The CLR

The CLR provides the .NET Framework with a collection of services that facilitate application execution. These services include the following:

  • Debugging

  • Memory management

  • Compiling

  • Security

  • Exception handling

For your Visual C++ applications to run, you must compile them. When you compile your Visual C++ applications, the Visual C++ statements that make up your applications are translated into Microsoft Intermediate Language (MSIL). One of the jobs of the CLR is to convert MSIL code into binary code that the computer understands.

Hint 

Compiling is the process of converting the programming statements that make up a given application into a format that the operating system can execute.

After the original source code for the application is converted to MSIL, it does not matter whether it was written in Visual C++, Visual C#, or any other programming language supported by Visual Studio. Because of this, you can mix and match multiple programming languages to create a single application.

Although all this might sound pretty complicated right now, the good news is that you don't need to understand it all to use it. The process of linking your program to the services or functionality it needs, communicating with other languages, or even distributing your program to other platforms occurs automatically. Microsoft Visual C++ 2005 Express Edition takes care of everything you need to create and deploy your applications. So if you find this material a little intimidating right now, don't worry. Just keep the big picture in mind and try to keep moving forward. As you gain comfort and familiarity with the language and concepts, you'll get the experience you need to start making sense of it all.

Hint 

If you want to learn more about the features of the .NET Framework, visit http://www.microsoft.com/net.




Microsoft Visual C++ 2005 Express Edition Programming for the Absolute Beginner 2006
Microsoft Visual C++ 2005 Express Edition Programming for the Absolute Beginner 2006
ISBN: 735615381
EAN: N/A
Year: 2005
Pages: 131

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net