Architecture of the .NET Framework
Architecture of the .NET Framework
The .NET Framework development platform introduces many new concepts, technologies, and terms. The goal of this chapter is to give an overview of the .NET Framework: to show how it is architected, to introduce some of the new technologies, and to define many of the new terms. I’ll also take you through the process of building your source code into an application or a set of redistributable components (types), and then explain how these components execute.
Compiling Source Code into Managed Modules
OK, so you’ve decided to use the .NET Framework as your development platform. Great! Your first step is to determine what type of application or component you intend to build. Let’s just assume that you’ve handled this minor detail, everything is designed, the specifications are written, and you’re ready to start development. Next, you must decide what programming language to use. This is usually a difficult task because different languages offer different capabilities. For example, in unmanaged C/C++, you have pretty low-level control of the system. You can manage memory exactly the way you want to, create threads easily if you need to, and so on. Visual Basic 6, on the other hand, allows you to build UI applications very rapidly and allows the easy control of COM objects and databases. If you use the .NET Framework, your code targets the common language runtime (CLR), which affects your decision about a programming language. The common language runtime is just what its name says it is: A runtime that is usable by different and varied programming languages. The features of the CLR are available to any and all programming languages that target it-period. If the runtime uses exceptions to report errors, then all languages get errors reported via exceptions. If the runtime allows you to create a thread, then any language can create a thread. In fact, at runtime, the CLR has no idea which programming language the developer used for the source code. This means that you should choose whatever programming language allows you to express your intentions most easily. You may develop your code in any programming language you desire as long as the compiler you use to compile your code targets the CLR. So if what I say is true, then what is the advantage of using one programming language over another? Well, I think of compilers as syntax checkers and "correct code" analyzers. They examine your source code, ensure that whatever you’ve written makes some sense, and then output code that describes your intention. Simply put, different programming languages allow you to develop using different syntax. Don’t underestimate the value of this. For mathematical or financial applications, expressing your intentions using APL syntax can save many days of development time when compared to expressing the same intention using Perl syntax, for example. Microsoft is creating several language compilers that target the runtime: C++ with managed extensions, C# (pronounced “C sharp”), Visual Basic.NET, JScript, Java, and an intermediate language (IL) Assembler. In addition to Microsoft, there are several other companies creating compilers that produce code that targets the CLR. At this writing, I am aware of compilers for Alice, APL, COBOL, Component Pascal, Eiffel, Fortran, Haskell, Mercury, ML, Mondrian, Oberon, Perl, Python, RPG, Scheme, and Smalltalk. The figure on the next page shows the process of compiling source code files:
Applied .NET Framework Programming
As the figure shows, you can create source code files using any programming language that supports the CLR. Then, you use the corresponding compiler to check syntax and analyze the source code. Regardless of which compiler you use, the result is a managed module. A managed module is a standard Windows portable executable (PE) file that requires the CLR to execute. In the future, other operating...
Please join StudyMode to read the full document