What is the .NET Framework? Microsoft’s answer to Java

Once limited to Windows, .NET also now allows developers to easily build apps for Linux, MacOS, and Android

Credit: Dreamstime

NET is a software development framework—and an accompanying ecosystem of tools, languages, and runtimes - created by Microsoft to ease application development across various platforms, from desktops to mobile devices.

Although .NET (pronounced dot net, and sometimes written as .Net) was originally tied to Microsoft’s proprietary Windows operating system and platforms when it was launched in the early ‘00s, .NET applications can now be written for the web, MacOS, iOS, Android, Linux, and more - and .NET is a formal standard and officially available as open source.

Microsoft describes .NET as “a consistent object-oriented programming environment, whether object code is stored and executed locally, executed locally but Internet-distributed, or executed remotely.”

.NET aims to provide safe execution of code, to deliver better performance than interpreted languages, and to make the developer experience consistent across a wide variety of apps.

Main components of the .NET Framework

The .NET Framework has been around for nearly 20 years, and has undergone a lot of changes, with components being rolled out and later deprecated over that time. At the moment, there are three main layers to .NET:

  • The .NET standard library includes the components that will form the infrastructure for just about any application you’d write - classes and types that are helpful in performing day to day tasks like dealing with strings and primitives, creating database connections, performing I/O operations, and so on.
  • Optional app models contain plumbing code for the various platforms where you might deploy your .NET application. There are a number of app models for Windows applications (a legacy of .NET’s close association with Microsoft’s ever-evolving flagship OS) and for other platforms as well: ASP.NET for web applications, for instance, and models for the Mac and various mobile platforms.
  • The common infrastructure is the base layer of components that enable the entire ecosystem to actually execute in practice, from compilers to languages to runtime components. These are crucial to understanding what .NET has to offer, so we’ll look at them in more detail in the next sections. 

How the .NET Framework works

The main components of the .NET Framework work together to make the process of writing applications easier. The standard library and app models provide a lot of code to handle basic programming tasks for you so you don’t have to reinvent the wheel with every application you build.

And the common infrastructure takes care of much of the scut work of deploying those applications.

Code written in any of the .NET languages (more on which in a moment) is compiled to an intermediate bytecode language called the Common Intermediate Language, or CIL. CIL code isn’t human readable, but can be ported across operating systems and platforms.

The CIL is then compiled again by the Common Language Runtime, or CLR. CLR implementations are platform-specific, and they compile CIL code into machine-readable code that can be executed on the platform of the moment. Different CLR versions support both just-in-time and ahead-of-time compilations.

In the process of creating local machine-readable code, the CLR also manages a lot of low-level application functionality, such as garbage collection and threading, that is crucial to app performance but often tedious for developers to deal with.

Together, the CIL and the CLR make up the .NET Common Language Infrastructure (CLI, and yes, we know all these abbreviations are similar and kind of confusing).

All of this should sound familiar to anyone who’s worked with the Java platform, as it follows the same basic paradigm—the large available class libraries, the intermediary bytecode, and the platform-specific runtime that automates memory management are all features of both offerings.

.NET was developed in the late ‘90s, during the initial heyday of Java, and was originally positioned as a competitor to the Java Enterprise Edition platform; the Java language and C#, the first and most prominent .NET language, are both derived from C and are semantically similar.

What are the .NET programming languages?

C#, announced with much fanfare upon .NET’s launch in 2000, is the most famous and widely used .NET programming language. It was developed internally by Microsoft as part of the .NET initiative, and most of the classes in the .NET standard library are written in C#.

The language is object-oriented and is designed to be similar enough to C to be easy for C, C++, Java, and JavaScript developers to quickly learn and use.

Microsoft currently also foregrounds two other programming languages that can be used to write for the .NET Framework. One is F#, a functional programming language that’s part of the ML language family that ultimately has roots in LISP; the other is Visual Basic, Microsoft’s venerable, easy-to-learn programming language for developing client-server applications.

But these are only the tip of the iceberg: Because .NET is composed of open standards, anyone can write a language that compiles to CIL bytecode and can be executed by the CLR. Wikipedia has a list of more than 20 currently maintained CLI language projects. Almost all of them represent .NET ports of existing languages, from Pascal to JavaScript to even COBOL.

The fact that this diversity of languages can coexist within the .NET Framework is one of the platform’s strengths. Because the code all gets compiled to CIL bytecode, .NET doesn’t really care which language you write it in; you can choose a language based on your own preferences, the different strengths and weaknesses of each language, or the different aspects of the .NET Framework each language gives you access to (there are some variations here).

As noted, most of the standard library was written in C#, but that doesn’t stop you from accessing those classes from code written in other CLI languages. Indeed, components written in different CLI languages can freely interoperate across a .NET application.

.NET Framework versus .NET Core (and beyond)

You’ll notice we’ve been using “.NET Framework” throughout this article to refer to the platform in general. Strictly speaking, that’s not correct: Microsoft uses that phrase to refer to their own longstanding implementation of .NET Standard, which exclusively focuses on Windows.

There have historically been other implementations of .NET; one of the most famous is Mono, an open source implementation first released in 2004 that made it possible to run .NET applications on Linux. The release gave rise to some controversy, as this was the era when there was still quite a bit of bad blood between Microsoft and the open source community.

Mono now forms the base of the Xamarin platform, which makes it possible build .NET applications for iOS, Android, and MacOS as well as Linux. Xamarin began life as the brainchild of the founders of Mono, but the company they founded to support the project was ultimately acquired by Microsoft.

The third major .NET implementation from Microsoft is .NET Core, a cross-platform implementation of .NET Standard that was released as open source in 2016. .NET Core was built fresh from the ground up and removed some of the cruft that had accumulated in .NET Framework, though it also lacked the full range of features.

Having multiple versions of the .NET Standard, all from Microsoft, is understandably somewhat confusing. In 2017, InfoWorld columnist Simon Bisson grappled with the question of which implementation should be used in which contexts.

But that’s all going to be changing in the not so distant future. In November 2020, Microsoft intends to unify the three .NET implementations as .NET 5. .NET 5 will in essence be the next generation of .NET Core, with a lot of components from the .NET Framework and Xamarin rolled into it.

However, a number of .NET Framework APIs will not be making the trip to .NET 5. The move aims to simplify things for developers and focus Microsoft’s own efforts.

What .NET Framework do I have?

As of this writing, though, that’s more than a year off. The current latest .NET Framework version is 4.8; the current version of .NET Core is 3.0. Microsoft has a page with instructions on how you can learn what version of the .NET Framework is currently installed on your computer.

What is .NET used for?

So all that gives you a great deal of what and how; but what you may still be wondering is why. Why use the .NET Framework? The Altexsoft blog has a good breakdown of the .NET pros and cons.

On the positive side, .NET provides an object-oriented programming model with a reliable and simple caching system and a mature IDE, and it allows for flexible deployment and easy maintenance.

In addition, the cross-platform nature of .NET allows code to be ported to many different kinds of endpoints. .NET is most appropriate if you’re building cross-platform apps on enterprise-scale infrastructures that you want to be able to scale up without having to completely retool.

Download the .NET Framework

Ready to start experimenting with .NET? Download the .NET Framework (for Windows) or .NET Core (for Windows, Linux, or MacOS) from Microsoft’s website; Docker images are also available. You can find Xamarin for iOS and Android on GitHub. Happy exploring!

Join the newsletter!

Or

Sign up to gain exclusive access to email subscriptions, event invitations, competitions, giveaways, and much more.

Membership is free, and your security and privacy remain protected. View our privacy policy before signing up.

Error: Please check your email address.

Tags Microsoft

More about EnterpriseGitHubLinuxMicrosoftWikipedia

Show Comments
[]