.NET
The .NET Framework is Microsoft's application development platform that enables developers to easily create Windows applications, web applications, and web services using a myriad of different programming languages, and without having to worry about low-level details like memory management and processor-specific instructions.
The Runtime
At the heart of .NET is the Common Language Runtime, commonly referred to as the CLR. The CLR is made up of a number of different parts, which I will be covering here piece by piece (if you didn't want a technical article then you should've followed the marketing link).
1. Language Independence
One of the most important facets of the .NET Framework is language independence. You can write .NET applications using any number of different programming languages. The most popular languages tend to be C# and VB.NET, but many other languages now have .NET versions including Python, COBOL, and more. You can see a list of many of the languages you can use with .NET over at dotnetpowered.com/languages.aspx.
Language independence is attained through the use of an intermediate language (IL). What this means is that instead of code being compiled in actual machine code (code that the CPU would run), it is instead compiled into a high-level generic language. This means that whatever language you write your code in, when you compile it with .NET it will become IL. Since all languages eventually get translated into the intermediate language, the runtime only has to worry about understanding and working with the intermediate language instead of the plethora of languages that you could actually use to write code.
2. Just-in-Time Compilation
If your mantra is, "Why do something now you can put off till tomorrow?" then you have something in common with the CLR. When you compile your code and it is translated to the intermediate language it is then simply stored in an assembly. When that assembly is used the CLR picks up that code and compiles it on-the-fly for the specific machine that is running the code. This means the runtime could compile the code differently based on what CPU or operating system the application is being run on. However, at this point the CLR doesn't compile everything in the assembly; it only compiles the individual method that is being invoked. This kind of on-the-fly compilation, referred to as jitting, only happens once per method call. The next time a method is called, no compilation occurs because the CLR has already compiled that code.
3. Memory Management
One of the constant assailants on productivity in unmanaged programming platforms is manually managing memory. Having to deal with memory management is also one of the largest sources for bugs and security holes in many applications. .NET removes the hassle of manually managing memory through the use of the aptly named garbage collector. Instead of the developer needing to remove objects from memory, the garbage collector looks at the current objects in memory and then decides which ones aren't needed anymore. For some developers this will be a tough pill to swallow; if you are used to managing memory then turning it over to an automated process can be somewhat troubling. This is when you have to take a step back, stop worrying, and embrace the runtime. There are bigger problems to solve (namely the business problems that are probably the real goal).
Alternative CLR Implementations
The .NET runtime is actually based on a standard developed by Microsoft called the CLI or Common Language Infrastructure, portions of which have been submitted to Ecma as an international standard. Because the CLR is based on an open standard, there have been a number of alternative CLR implementations, most notably Rotor and Mono. Rotor was a project from Microsoft Research, is a version of the CLR that will run on Mac OS, and is shared source. Mono is an independent open source implementation of the CLR that runs on various Linux distributions. While "Write once, run away" is not always realistic with .NET, there are some options available when it comes to other platforms. (Some code can be moved without issue, but most will require some tweaking, as different implementation includes different functionality.)
The Library
While the runtime is definitely the most important part of .NET, you can't do too much with it by itself. This is where the Base Class Library (or BCL) comes in. The BCL includes a lot of the plumbing of .NET, including the system types, IO, and functions for working with text. In addition to the BCL, there is the Framework Class Library (FCL). The FCL is an extended library that makes working with the .NET Framework practical and includes the following major pieces:
No comments:
Post a Comment