Introduction
Reading
Welcome to .NET
Microsoft .NET is a new framework for building applications. This new framework allows developers to write applications faster and with a lot less code.
The .NET framework is able to work with a variety of languages (C#, VB.NET, Cobol.NET, Fortran.NET, ...). The advantage of multiple language support is that you don't need to tie yourself down to a single language. You also don't need to rewrite all of your existing code to make use of its benefits. You can create all the new code in .NET and leave the legacy code alone. And you can have the legacy code call the new .NET code. It works backwards and forwards.
.NET enables modern communication through standard Internet protocols such as XML and SOAP. Through the use of Web Services you open a whole new world of communication. We'll discuss Web Services later.
The end result of .NET is that it makes it far easier for developers to write and maintain programs that solve complex business problems.
Data Access
.NET applications can access a variety of data sources such as SQL Server, Oracle Server, Access, ODBC, and OLEDB databases through ADO.NET.
ADO.NET accesses data in a generic fashion. You can switch databases with minimal changes to your source code. It allows support for disconnected data and XML support.
Security
Security is not an afterthought in .NET. It is built into the system. Because all .NET code must be compiled on the user's machine, the CLR can verify that the code is living within the security restraints associated with the machine.
For example, I can set my machine so that no file access is allowed. Now whenever a .NET application tries to create or write to a file, the CLR will generate a security error and stop the application.
Security is one of the most important issues to consider when dealing with software. Microsoft .NET provides a rich security system that is built into the core of the framework.
You can write code that only allows a certain user or group of users to execute it. This is called code access security. It's an additional level of security on top of the operating system's security.
When the .NET framework runs code, it verifies whether the code running is valid based on the code access security and the person running the code. In fact, when the program is loaded into memory, it is verified for security.
Security policies can also be used to allow or disallow certain program behaviors. For example, programs run from the Internet are not allowed to create files on the user's machine. It's a pretty good policy to have and if you like you can change it to allow it.
.NET Framework
The .NET framework consists of many parts. It no longer makes a difference as to what language you use for your application. As you can see below, the Common Language Runtime (CLR) which provides the core .NET functionality is the same regardless of the language. Above the CLR is the the .NET framework class library which provides all the Windows functionality for building an application such as drawing, menus, file handling, networking, and so forth. And above that are the .NET languages. So you can see that regardless of the language you have access to the same .NET functionality.
Figure 1. The .NET Framework
The Common Language Runtime (CLR) is responsible for providing a consistent set of services to .NET applications. The CLR manages memory, handles security, the basic data types, and error handling.
Figure 2. The Common Language Runtime
The .NET framework class library provides all the functionality to handle networking, file handling, machine security, debugging, complex arrays, and so forth.
Figure 3. The .NET Framework Class Library
Today developers using C++ use the Microsoft Foundation Classes (MFC) or use the Active Template Library (ATL) to write applications. Java developers use the Windows Foundation Classes (WFC), and VB developers use the Visual Basic APIs. Each framework (MFC, ATL, WFC, etc) works differently and is specific to a language. The .NET framework unifies the different languages and frameworks. Developers no longer have to learn multiple frameworks to do their work.
Deployment
Installing an application is always a difficult problem. In .NET it is trivial. To install a .NET application, you simply copy the files down to a directory and run it.
Uninstalling an application is always difficult. You need to make sure that you delete only your files otherwise you may damage the system. In .NET all you do is delete the directory where you installed the files and go on with your life.
Managed Code
When you compile a .NET application you don't generate code that can actually execute on your machine. You actually generate Microsoft Intermediate Language (MSIL or just IL). All .NET code is IL code. IL code is also called Managed Code, because the .NET Common Language Runtime manages it. One of the tasks the CLR does is convert the IL code into Native code so that it can actually execute.
Figure 4. Compiling a .NET Application
The first three steps are done on the developers machine. The developer generates some .NET code and is ready to ship it to the customer. The customer installs the .NET code (IL code) and when the customer tries to run the .NET application, the CLR jumps in and compiles the code into machine code. The CLR compiles the code each and every time the customer runs the .NET application.
The advantage of this system is that the JIT'er (Just in time compiler) compiles the application on the user's machine. What if the user's machine has two Pentium 4 microprocessors? The JIT'er could generate native machine code to take advantage of the two processors. In other words, the JIT'er could take advantage of whatever resources the user had on their machine to make the program run faster.
Summary of .NET
-
Rapid Development Tool: A new framework for building applications faster and easier using less code.
-
Independent: No language dependency because of the Common Language Runtime (CLR). The CLR provides a consistent set of services (See Figure 2).
-
Functional: The .NET class library provides functionality to handle basic tasks (files, security, arrays, debugging, etc) (See Figure 3).
-
Unification: You no longer need to deal with multiple frameworks such as MFC, Java WFC, VB api, ATL, and so forth.
-
Productive: No need to sacrifice flexibility to raise productivity or vice-versa.
-
Powerful: Provides quick development combined with all the functionalities beneath the platform (the ability to code at a low-level when the need arises).