THE MICROSOFT.NET FRAMEWORK


All of the various Visual Studio programming languages, whether Express or ful-featured versions, are designed to work with the Microsoft .NET Framework. Microsoft created the .NET Framework to provide a multilanguage application development environment capable of supporting the creation of applications and services for Windows, the Web, and mobile devices.

image from book
IN THE REAL WORLD

Thanks to the multilanguage development environment provided by the .NET Framework, applications created using Visual Studio .NET can involve multiple languages. For example, an application might include code written in both Visual Basic and another Visual Studio programming language such as C#. This allows companies to break application development projects into parts and to assign the various parts to programmers who are using different programming languages based on their particular areas of expertise or upon the strengths and weaknesses of a particular programming language.

image from book

The .NET Framework is at the core of the Windows application development environment. Therefore, a basic understanding of .NET is a critical part of any Visual Basic programmer's foundation.

image from book
DEFINITION

.NET is a Microsoft framework that has been designed from the ground up to support integrated desktop, local area network, and Internet-based applications.

image from book

Before .NET

Before the introduction of .NET, Microsoft created and encouraged the use of the COM (Component Object Model). Using COM, Windows programmers were able to gain access to numerous system resources. COM also represented Microsoft's first attempt at creating an OOP standard. COM provided programmers with the ability to create component libraries made up of code that could be reused by different languages, such as Visual Basic and C++.

Before the arrival of .NET, early versions of Visual Basic depended on Windows DLL (dynamic link library) files for much of their core functionality. Visual Basic automatically loaded DLL files onto your computer when you installed Visual Basic. Things would get complicated when programmers finished developing their applications and were ready to deploy them. In order for their applications to work, the programmers had to make sure that all the DLLs that their applications needed to run were also installed on each user's computer. To help make this task easier to manage, Microsoft provided Visual Basic with the ability to create a deployment package that automatically collected all the DLLs required by a given application. Although this made things easier on the programmer, it also made for some very large deployment packages. In most cases, even the smallest Visual Basic deployment package would easily grow to be 30 to 40 MB in size.

Unfortunately, package deployment size was not the only DLL problem that programmers had to contend with. Problems sometimes occurred because deployment packages would replace DLL files already installed on a user's computer with older versions of DLL files. This often caused other applications on users' computers to break. This situation was so common and difficult to deal with that programmers ultimately began to refer to it as DLL Hell.

Microsoft's solution to DLL Hell is the .NET Framework. The .NET Framework is now responsible for providing Visual Studio programming languages with 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. Now 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 supports application development and execution on Windows operating systems, the Internet, and mobile devices such as PDAs. 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, Web server, or a Pocket PC device.

image from book
Figure 1.5: Microsoft .NET Framework enables the development of multilanguage applications on different execution environments.

As Figure 1.5 shows, the .NET Framework is made up of two primary components. These are:

  • .NET Framework class library

  • CLR (common language runtime)

The .NET Framework Class Library

The .NET class library is made up 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.

The .NET class library contains the code required to create forms, buttons, and other Visual Basic controls. For example, to create a new form within a Visual Basic application, you would call upon a predefined class that already had 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 dragged and dropped a Button control onto the form, the .NET class library would automatically supply your application with all the underlying code, defining how the button looks and how your application can interact with it.

image from book
DEFINITION

A class is a collection of code representing a programming object, such as a form, a button, or a text When you create a new form or add a control to a form when building an application interface, you are instantiating new objects based on predefined classes stored in the .NET class library.

image from book

The CLR

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

  • Debugging

  • Memory management

  • Compiling

  • Security

  • Exception handling

In order for your Visual Basic applications to run, they must be compiled. When your Visual Basic applications are complied, the Visual Basic statements that make up your applications are translated into MSIL (Microsoft Intermediate Language). One of the jobs of the CRL is to convert MSIL code into binary code that the computer understands.

image from book
DEFINITION

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

image from book

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

Although all this may sound rather complicated, the good news is that it all occurs under the covers. Visual Basic 2005 Express automatically takes care of all this for you as you create and save your applications. So if you find this material a little intimidating right now, don't worry. Keep pressing on, and as you get more experience, it will start to make more sense.

Hint 

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




Microsoft Visual Basic 2005 Express Edition Programming for the Absolute Beginner
Microsoft Visual Basic 2005 Express Edition Programming for the Absolute Beginner
ISBN: 1592008143
EAN: 2147483647
Year: 2006
Pages: 126

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