View Full Version : Machine Independence and Self-Compiling of .NET

04-25-2003, 10:35 AM
Originally posted by Solo
The biggest selling point of .Net is that it adds machine independence (like Java). However, unlike Java the .Net platform compiles the code on the target machine the first time it's run thus avoiding the overhead imposed by an interpreter.
The quote came from this thread: C Board > Platform Specific Boards > Windows Programming > Recommended Book on COM :: C++

I have asked many people about what exactly .NET is all about. The most anyone has been able to explain is that .NET is supposed to tie every application/computer to MS via the internet whenever it runs...
I honestly still don't have any idea what .NET is about. I just came across that quote above and found the statement remarkable. So, .NET creates apps that self-compile on the client machine when you run them? If that's true, that is really very interesting..

What do you know about it?

04-25-2003, 12:03 PM
That's basically it. You distribute the executable straight from the compiler. At that time it's not really binary but another language (called something like intermediate language, not really sure). The first time you run it. It does a JIT (just in time compilation) and finishes compiling. It's not untill now that it's really a binary file. The more you run it, The faster it will compile each time you run it.
Not so sure about machine independence, you have to have installed the .NET framework and I think that requires you to have one of the latests versions of Windows (not sure about this).

04-26-2003, 11:28 PM
>>The more you run it, The faster it will compile each time you run it.

Um... and how would it compile 'faster and faster' each time? That doesn't make any sense.

04-27-2003, 08:52 AM
.NET is a new strategy being implemented by Microsoft. It's purpose is to replace the current aging APIs used by Windows with a newer, more extensible framework. It also provides a new way to develop applications and services for the Internet. It's design and all is very similar to Java except that .NET can support more than one language. That means a class that you write in VB.NET can be used by C# which in turn can be inherited in C++.NET and back to VB.NET and Fortran.NET etc etc. (Java in theory can support more than one language but it will not be done.)

This is how a program's lifetime goes: It is developed in any language in the .NET Framework and compiled to MSIL (Microsoft Intermediate Language). This is bytecode. In order to run this bytecode, the user computer must have the .NET Framework Client/SDK installed. At that time, the CLR (Common Language Runtime) takes the MSIL and compiles it natively through a JIT (Just-In-Time Compiler). That way, .NET applications are portable to any platform and run just as fast as a natively compiled application.

If you're having doubts about speed: C# runs only 5-10% slower than C++, which is amazing for all the features it provides like garbage collecting and all the classes and functionality in the System.* namespace. And if you're really picky, C++.NET can mix managed (.NET compiled) and unmanaged code (native fast code) and use them very efficiently. You can make speed critical things in C++ using ASM, make a wrapper for them, and use them in C#/VB.NET/etc. I bet you will never have to do that though. .NET is powerful enough.

The name .NET implies the Internet. .NET provides XML Web Services along with discovery and description services for them and Web Applications in ASP.NET. If you know anything about ASP then imagine that 100x better. Each page is compiled for speed and has full access to all the classes and you can use your normal .NET code with it. You can even seperate the code from the HTML if you want.

This will not die. It's already being used by a lot of companies, even my dad's. Microsoft has already stated that .NET will be used in the new version of Windows (codename LongHorn) as its only API. I don't mind because I think its a GREAT improvement over the old-style handles, messages, and such.

If you're worried about price, don't. The .NET Framework SDK is free for download right from www.microsoft.com. All the tools and compilers are there but they are command-line. I suggest you getting Visual Studio.NET because it makes everything so much easier.

04-27-2003, 01:32 PM
Thanks for the in depth explanation. It is very appreciated.

Originally posted by Speedy5
the user computer must have the .NET Framework Client/SDK installed.
So, is it safe to assume that the .NET framework client/SDK will be available to any machine (mac, linux, etc)? I would naturally assume that only a windows box could use it, but that would hinder the ability for it to be "portable to any platform"...

Curiouser and curiouser... Again, thanks for the info.. It seems impossible to get some actual factual info on .NET.

Another thought just hit me... If you have to have .NET installed for the JIT, etc, does that mean a computer will not be able to run an application unless it has .NET? That's what it's sounding like since the application is not binary and can not be made binary without .NET... hmmm..

04-27-2003, 04:47 PM
.NET is designed to be portable, however, at this current time, only Windows has implemented the full framework. There are third parties working on it for other platforms like Mono which will work on Unix boxes. And Corel was making a port to Linux. By the way, Microsoft is encouraging all this but won't actually make the ports.

For the other question: I have no idea what you're asking. But for the new Windows, at this time it seems like only .NET code will be able to interface with the operating system. This, of course, can change.