| What is .NET? |
|
|
| Written by Markus Ewald | |||
| Saturday, September 02 2006 19:03 | |||
|
This article tries to explain what .NET is and where the differences lie to the traditional concept of software development. Compilation ProcessLet's take a look at how programs are compiled by traditional compilers and by a .NET compiler. Traditional Compiler
Traditional software, written in a programming language like C or C++, is transformed from source code into machine code by a compiler, producing a so-called binary (usually with file extensions like .dll, .exe or .so). This binary can then be run by the end-user as long as his CPU understands the machine code instructions and his operating system provides the external functions used.
Such binaries are bound to a single platform (= operating system and CPU architecture).
A Windows binary compiled for x64 CPUs won't work on Linux. At least not
without some kind of emulation software that tries to simulate the platform expected by the
binary. Similarly, it will not work in x86 environments.
.NET Compiler(s)
Source code written in a .NET enabled language is instead compiled to an intermediate format called CIL (Common Intermediate Language). This language is independent of any CPU architecture. Only when a CIL binary is executed does it get transformed into actual machine code by the platform's .NET runtime. This means that you can copy a CIL binaries to other computers running a 64 bit OS, Linux, MacOS or even your mobile phone. Their respective .NET runtime (eg. the Microsoft .NET Framework or Mono will generate suitable machine code in the instant you attempt to launch the program.
So as to not rely on external functions that are operating system specific, .NET defines an
extensive class library called the .NET Framework that interfaces with the underlying
platform and provides .NET programmers with a clean and unified interface. In other words,
a .NET program only interfaces with the .NET Framework and then the platform's respective
implementation of the .NET Framework does the operations needed by calling into platform
dependent code.
Pros and ConsHere is a short overview of the advantages and disadvantages offered by .NET: Advantages of .NET
Drawbacks of .NET
Summary.NET is much more fun to work in because of the well organized .NET Framework, because you can package your classes in neat assemblies and no longer have to worry about making sure the header version matches the library, using the right runtime library, static or dynamic binding, 32 bit or 64 bit builds or even which operating system you're targeting. Modern language features such as reflection (introspection) and dynamic code generation allow you to use powerful programming techniques such as unit testing, creating dynamic mocks, measuring test coverage and managing your dependencies with an inversion of control container. In C++, only unit testing is marginally supported. Native code gives you more control and has many more established libraries doing all kinds of things from image processing to video decoding to physics simulation. Lots of libraries are being ported to or wrapped in .NET, but until libraries emerge that are written in .NET and for .NET, these will always be second-class interfaces that lag behind their native counterparts.
|

