Home  |  Delphi .net Home  |  Overview of .Net
 .NET Framework
 Namespace References

 System.Drawing - download only

 Articles and Tutorials

 Overview of .NET
 Delphi and .NET
 Winform Applications
 ASP .Net Applications
 ASP Web Services
 Framework Collections
 Framework String Handling
 Framework Files and Folders

 Author links

 Buy Website Traffic at

 Buy Proxies at

 Overview of .Net
What is .Net?
In the words of the originators :
   ".Net is the Microsoft solution for Web Services, the next generation of software that connects our World of Information, devices, and people in a unified, personalized way."

Except that this is misleading. It implies that .Net revolves around Web Services. This is not strictly true : a .Net application can run without using Web Services at all, much like a Windows Win32 application.
From the perspective of the author, this focus on Web Services is intended to divert attention away from the main thrust of .Net : as a rival to Java.
Java is a technology developed by Sun that allows code to be written once, and deployed unchanged on different Operating Systems and devices, from PCs and Macs to PDAs (Personal Digital Assistants).
Java code is compiled into intermediate bytecode. This is run as a mixture of interprated and compiled code (to suit the running device) by the Java run-time environment. The compilation is very intelligent, mostly employed for repetitive sections of code.
.Net code is compiled into an Intermediate Language (IL) that gets Just in time compiled into device machine language by the .Net Common Language Runtime.
As was said, Microsoft leveraged in Web Services, and some other benefits to try to match or outshine Java :
 Language Independance
   - Delphi, C#, C++, Visual Basic + other languages are supported
   - A common set of visual and non-visual classes usable by all languages
   - Java can in principle support multiple languages
 Device and platform independance
   - Language code is compiled into an intermediate code
   - On the target device, the code is compiled as it is used
   - This is equivalent to Jave ByteCode
 Resolution of big programming problems
   - Memory leaks largely resolved
   - DLL sharing problems largely resolved
 Web services integrated into .Net
   - Web services are applications that run on an Internet server
   - They can be accessed by .Net applications running anywhere

Note that a .Net application does not need to use Web Services. These are the application types that you can build in .Net :
 Windows Forms
   - Traditional windows type applications that do not use web services
 VCL Forms
   - Allows you to build a .Net app that uses Delphi VCL controls/classes
 Web Forms
   - Internet applications that may or may not use web services
 Web Services
   - A web service for you or others to use
 Console application
   - Application with no user interface that may or may not use a web service
 Windows Service Application
   - User independant, long running background application

Note that Delphi 8 is shipped with Delphi 7 since the latter is required if you want to build Win32 applications. Delphi 8 for .Net cannot create Win32 applications.

Language Independance
When desiging .Net, Microsoft found themselves encumbered with a number of Object Oriented languages, including the newly developed C# (pronounced C-Sharp). Being wary of their huge user and application base, Microsoft chose to approach the design of .Net in a language independant manner.
This was relatively comfortable to do, since the language code is compiled to an Intermediate Language (IL) code that is similar to machine code, but is language and machine (platform) independent.
However, only the language statements are mapped to IL code - all languages must use (or inherit from) classes that Microsoft provide. This was necessary for many reasons, not least the sheer scale of the classes each language traditionally uses.
These classes, and a set of common data types are to be found in the .Net Framework. This is huge and is covered further on in this article.

Device and platform independance
If we look at the goal of Java, we see a technology that allows an application to be written once, but run without changes on Windows, Linux, Mac or any platform that has a Java runtime interprator.
Microsoft are looking to emulate this with .Net. For example, they are currently working on support for PocketPC devices that use ARM, MIPS or SH3 processors. Future plans look to embrace Linux, FreeBSD and Unix.
Java has grown enormously over the years, and Microsoft are wary of this. They took early heed, and will only implement a much reduced Framework on devices with small resources. This is called the Compact Framework (CF). (In the Delphi for .Net references, methods are marked as CF compatible or not).
They also took heed of the Java performance issues that mostly result from the fact that Java code is interpreted. .Net Intermediate Language code is Just In Time (JIT) compiled when run. The code is compiled in sections, as they are executed. And compiled only once. So performance is generally extremely good.
The compilation and execution is carried out by the Common Language Runtime (CLR), and is covered further on in this article.

Resolution of big programming problems
Over the years, as programming languages and environments undergo accelerated changes, problems appear, and there seems to be too little time to address them before moving to the next set of advances.
Microsoft took heed of this when designing .Net - they had, and used a golden opportunity to address a number of key issues :
Memory leaks largely resolved
In Object oriented applications, objects are frequently created. They are never directly accessed - an object name is merely a reference to the object instance. Creating a new object, and assigning it to an existing object instance will lose reference of that original object. This creates memory leaks - memory used by the now inaccessible object is not recoverable.
Like Java, .Net manages this by providing memory management and automatic garbage collection - objects no longer referenced are destroyed.

DLL sharing problems largely resolved
Dynamic Link Libraries are files that contain a library of programmatic functionality, available to any application that knows about them. When an application runs, it can literally dynamically link routines from the library into itself.
The problem with allowing entities such as files to be shared is that there is no one owner. When a new application installs new versions of DLLs, then existing applications will no longer operate correctly. Likewise, when uninstalling an application, the application cannot guarantee that the DLLs to be removed are not actively used by other applications.
.Net overcomes these problems by allowing the .Net equivalent of DLLs to contain version information. Multiple versions of the same DLL may coexist. Exactly how this overcomes the uninstall problems is not clear to the author.


Web Services
Web Services is a somewhat confusing name., the Internet bookshop is a web service. In the .Net context, a web serives is an application that resides on an appropriate server accessible that provides a service to a .Net application wherever that application may be. As long as it can access a dedicated server, it can use the web service.
For example, you may have an application that sits on your Palm Pilot that uses a web service to tell you when Liverpool have scored a goal in the match currently being played. Or you may use a web service to book a hotel. Or to provide some financial services for your web site. Or use the Microsoft MapPoint web service to display a map on your web site.
Web services introduces a number of 'buzzwords', so fondly admired by programmers :
 RPC : Remote Procedure Calling
   - The name given to the process of accessing a web service
 HTTP and HTTPS : HyperText Transfer Protocol / Secure
   - The communications protocol used to invoke the web service RPC
 XML : eXtensible Markup Language
   - The plain text formatting technique to transfer requests and responses
 SOAP : Simple Object Access Protocol
   - The style used for XML markup when accessing web services
 UDDI : Universal Description, Discovery and Integration
   - A public registry of web services, located at

In addition to providing a standardised request and response mechanism for web services, this set of communications protocols can be used to bridge heritage applications. Often, a billing application would be designed by a different team to the payroll application, and communication between the two would be complex. Using XML as a wrapper around the communications can resolve many problems, as well as allowing an easier migration to a replacelemnt payroll application, for example.

The .Net Framework
A massive benefit derived from the common set of classes in the Framework is that switching languages becomes a much simplified task. Essentially only the syntax needs to be learnt - effort spent learning the classes is highly justified and becomes durable knowledge.
The classes are extensible (Borland extended them to provide VCL classes).
The classes cover visual components, data manipulation, database access, reflection and so on.
Introduced in these classes is an extra level of class name referencing : each class resides in a NameSpace. The most important namespace is called System. It holds key classes such as Object and Exception, and all of the Common Language data types.
Data types are not language primitives (remember, the Framework is language independant), but are a special kind of class called a Structure. These are fixed in size, (and can therefore be stored efficiently on the stack), are accessed by value but can still have methods. For example, the DateTime structure holds a date and time value, and provides methods allowing the date and time value to be manipulated and formatted.
Whilst Microsoft provide a massive reference for all of these classes and their members (methods, properties and so on), the syntax and examples is only given for a few languages. Delphi is not one of them. The DelphiBasics web site overcomes this for the major namespaces. Each class method has example code to help you out.

The Common Language Runtime (CLR)
An application in .Net is stored inside an Assembly. They contain 1 or more Managed Modules, plus resources such as html files and images. To install the assembly, simply store it in a folder on the target machine.
Since the assembly contains meta information about itself, the CLR can easily execute it. It extracts the Intermediate Language code from the managed modules in the assembly, compiling sections on demand (Just in time) into native platform machine code as it executes.
The CLR is like a wrapper around the running application, providing safe memory management and garbage collection.
Delphi Programming Neil Moffatt 2002 - 2016. All rights reserved.  |  Home Page