One of the things that can be most challenging when starting to learn a new technology is beginning to wrap your head around the terminology that is used. While the concepts are often somewhat uniform across all the different technologies, each has chosen to use a different term for those things. At least for me, that has been one of the biggest friction points in learning F# and .NET, so I thought I’d dig into a few things, and what surprised me about them.
- .NET as an all-encompassing platform that includes standards, runtimes, libraries, and even core frameworks.
- .NET as the runtime, specifically the language runtime that executes the Microsoft intermediate language (MSIL), which is similar to the JVM bytecodes.
Fortunately, most of the time it’s not a difference that is super important. There are two major .NET runtimes that are popular in the .NET world:
- .NET Core (now simply called .NET 5), which is Microsoft’s open source runtime. This runs on Windows, macOS, and Linux (at least).
- Mono, a cross-platform lighter runtime that implements the .NET standard. It’s available on a large number of platforms, including Android and iOS.
For my purposes, I’m going to be working on .NET 5, which is the latest, greatest implementation from Microsoft.
The first real word I ran into that confused me was “assembly”. Microsoft defines them as:
An assembly is a collection of types and resources that are built to work together and form a logical unit of functionality. Assemblies take the form of executable (.exe) or dynamic link library (.dll) files, and are the building blocks of .NET applications.
So, really, they’re like ELF, JAR, and shared libraries had a baby, and baked in a type system at the same time. In fact, like a shared library, you can share them between applications. But like JAR files, they have a clear manifest model, and can contain not just executable code (in the form of MSIL), but also resources like images, localization maps, etc.
Assemblies can be collected together for distribution as a packege.
For .NET, packages are managed using NuGet.
This includes managing dependencies of all the associated packages.
One thing I found a little weird at first was that NuGet calls the installation of dependent packages a restoration.
For example, you’d run
dotnet restore to install/re-install all the packages for a project.
Of course, like all package management systems, it’s important to ensure you ignore certain things in version control.
TFM (Target Framework Moniker)#
The TFM is the specification of the API/ABI that your project or SDK expects to have in order to function.
This was all heavily overhauled in .NET 5.
Fortunately, since I’m only working on .NET 5, I only need to worry about the new version.
That means I can specify
net5.0 if I’m doing something cross-platform that doesn’t use any OS-specific components.
If, instead, I want to write something that is going to only run on macOS, then I can use
net5.0-macos, and even continue that further to specify a minimum macOS version, such as
net5.0-macos10.15 to say that I need Catalina as my minimum version.
This can be seen as somewhat akin to information you would specify in Maven POM files, or even the platform details of Python wheels.
A culture in .NET terminology is similar to a locale in the Linux world.
This includes what they call an invariant culture, which we might think of as something similar to the
Fortunately, this is a major improvement over the old Windows model that used all sorts of numbers with special meaning,
One thing I find especially encouraging is that the .NET libraries seem to be more consistent and thorough in their handling of localization issues than what I’ve seen in most places. This guide provides a good insight into best practices.
One last term I ran into is XAML which confused me for a minute. The main issue was I kept reading it and seeing XACML which, while also XML-based, is a wildly different technology. XAML is an XML-based declarative UI definition language, like this:
<StackPanel> <Button Content="Click Me"/> </StackPanel>
The idea being you can more easily write Windows Presentation Foundation (WPF) GUI apps. This is not an area I’m particularly interested in at this point.