[.NET Framework] Developer’s Point of View

Let’s review what we think we know but we don’t know exactly. You know what .NET Framework is. But can you explain it to others? Well, it will be tricky, right? .NET Framework is like OSs. Its paws crawl all over the places. What about all those acronyms? Do CLR, CTS, CLS, and CLI make sense to you? If not, let’s make them clear as simply as possible.


1. CLI (Common Language Infrastructure)

.NET framework is not just for Windows Operating System. To make .NET framework a standard for multiple OSs, Microsoft created an open specification, which defines a runtime environment for .NET applications and services.

The CLI is not OS-specific. It allows multiple .NET-aware languages to be used on different platforms without being rewritten.


2. CLR (Common Language Runtime)

The CLR is the Microsoft’s implementation of the CLI standard. It refers to the runtime part of .NET Framework.

When you compile your .NET application, the code converts into platform-agnostic CIL(Common Intermediate Language) code. At runtime, the CLR’s JIT(Just-in-time) compiler – also called “Jitter” – converts the CIL code into the native code to the specific operating system.


3. DLR (Dynamic Language Runtime)

The DLR is an additional runtime environment. It is built on top of CLR. DLR enables the support of dynamic types from any source (especially COM).


4. CTS (Common Type Systems)

The CTS describes all possible types and programming constructs. It is not language-specific.

All Clear? Well, not quite yet. What is a type, anyway? Integer, double, or Boolean?

In .NET, a type refers to a class, an interface, a structure, an enumeration, and a delegate. The CTS defines how each type is defined and constructed.


5. CLS (Common Language Specification)

The CLS defines a subset of CTS – common data types and programming constructs – that all .NET programming languages can agree on. It defines the base rules to which any .NET-aware languages should conform in order to interoperate with other CLS-compliant languages.

For example, C# provides several non CLS-compliant constructs for programmer’s convenience such as returning unsigned integer as a return value of a method. You can instruct the C# compiler to check your assembly for CLS compliance using an attribute:

// AssemblyInfo.cs
[assembly: System.CLSCompliant(true)]

Now I create a method which returns uint type:

public class MyClass
  public static uint Test()
    return (uint)10;

When you compile the code, the compiler generates a warning “Return Type of ‘Test()’ is not CLS-compliant.”

6. FCL (Framework Class Library) & BCL (Base Class Library)

.NET Framework also provides a lot of pre-built classes for programmers.

The FCL is a collection of reusable types for all .NET development, which includes ASP.NET, WCF, EF, etc..  The BCL is the core of FCL and encapsulates a lot of common functions. The classes in the FCL and BCL are organized into namespaces and assemblies. You can reference assemblies in your project and enjoy the benefits of ready-to-use functionalities. You can think that namespaces are logical groupings of classes and assemblies are physical containers of classes. Classes in the same namespace can be spread across multiple assembly files.

The most noticeable point is that BCL is not specific to programming languages. It is not like that C# has its own BCL and VB.NET has its own BCL, etc. BCL are assemblies which contain language-agnostic CIL code. So all .NET programming languages can share the library.


7. Assemblies

When you compile your .NET project, it will create .exe or .dll files. They are called “assemblies“. An assembly is not just a CIL code block. It consists of CIL code and metadata that describes the detailed information of every “type” in the assembly. It also contains the description of itself, which is called “manifest“. The manifest includes the version, culture, and externally referenced assemblies.

In general, one assembly is mapped to one file (one-to-one). This is called “Single-file Assembly”. A single-file assembly contains all necessary CIL code, metadata, and manifest in a single file as a package.

Meanwhile, one assembly can be separated into multiple files (multi-file assemblies). In this case, one file (primary module) must contain the assembly manifest, and other files (modules) contain a module-level manifest.


8. Parallel Computing Flatform

.Net Framework provides the programming model to meet the Increasing needs of multithreaded and asynchronous applications.

  • Parallel Loops Iterations
  • Parallel LINQ
  • Lock-free and thread-safe collections

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s