What .NET Developers ought to know to start in 2017
Many many years ago I wrote a blog post about what .NET Developers ought to know. Unfortunately what was just a list of questions was abused by recruiters and others who used it as a harsh litmus test.
There's a lot going on in the .NET space so I thought it would be nice to update with a gentler list that could be used as a study guide and glossary. Jon Galloway and I sat down and put together this list of terms and resources.
Your first reaction might be "wow that's a lot of stuff, .NET sucks!" Most platforms have similar glossaries or barriers to entry. There's TLAs (three letter acronyms) in every language and computer ecosystems. Don't get overwhelmed, start with Need To Know and move slowly forward. Also, remember YOU decide when you want to draw the line. You don't need to know everything. Just know that every layer and label has something underneath it and the whatever program you're dealing with may be in a level you have yet to dig into.
Draw a line under the stuff you need to know. Know that, and know you can look the other stuff up. Some of us want the details – the internals. Others don't. You may learn from the Metal Up or from the Glass Back. Know your style, and revel in it.
First, you can start learning .NET and C# online at https://dot.net. You can learn F# online here http://www.tryfsharp.org. Both sites let you write code without downloading anything. You just work in your browser.
When you're ready, get .NET Core and Visual Studio Code at https://dot.net and start reading!
Need To Know
- What's .NET? .NET has some number of key components. We'll start with runtimes and languages.
- Here are the three main runtimes:
- .NET Framework - The .NET framework helps you create mobile, desktop, and web applications that run on Windows PCs, devices and servers.
- .NET Core - .NET Core gives you a fast and modular platform for creating server applications that run on Windows, Linux and Mac.
- Mono for Xamarin - Xamarin brings .NET to iOS and Android, reusing skills and code while getting access to the native APIs and performance. Mono is an open source .NET that was created before Xamarin and Microsoft joined together. Mono will support the .NET Standard as another great .NET runtime that is open source and flexible. You'll also find Mono in the Unity game development environment.
- Here are the main languages:
- C# is simple, powerful, type-safe, and object-oriented while retaining the expressiveness and elegance of C-style languages. Anyone familiar with C and similar languages will find few problems in adapting to C#. Check out the C# Guide to learn more about C# or try it in your browser at https://dot.net
- F# is a cross-platform, functional-first programming language that also supports traditional object-oriented and imperative programming. Check out the F# Guide to learn more about F# or try it in your browser at http://www.tryfsharp.org
- Visual Basic is an easy language to learn that you can use to build a variety of applications that run on .NET. I started with VB many years ago.
- Where do I start?
- After runtimes and languages, there's platforms and frameworks.
- Frameworks define the APIs you can use. There's the .NET 4.6 Framework, the .NET Standard, etc. Sometimes you'll refer to them by name, or in code and configuration files as a TFM (see below)
- Platform (in the context of .NET) - Windows, Linux, Mac, Android, iOS, etc. This also includes Bitness, so x86 Windows is not x64 Windows. Each Linux distro is its own platform today as well.
- TFMs (Target Framework Moniker) - A moniker (string) that lets you refer to target framework + version combinations. For example, net462 (.NET 4.6.2), net35 (.NET 3.5), uap (Universal Windows Platform). For more information, see this blog post. Choosing a TFM decides which APIs are available to you, and which frameworks your code can run on.
- NuGet - NuGet is the package manager for the Microsoft development platform including .NET. The NuGet client tools provide the ability to produce and consume packages. The NuGet Gallery is the central package repository used by all package authors and consumers.
- What's an Assembly? - An assembly is typically a DLL or EXE containing compiled code. Assemblies are the building blocks of .NET Full Framework applications; they form the fundamental unit of deployment, version control, reuse, activation scoping, and security permissions. In .NET Core, the building blocks are NuGet packages that contain assemblies PLUS additional metadata
- .NET Standard or "netstandard" - The .NET Standard simplifies references between binary-compatible frameworks, allowing a single target framework to reference a combination of others. The .NET Standard Library is a formal specification of .NET APIs that are intended to be available on all .NET runtimes.
- .NET Framework vs. .NET Core: The .NET Framework is for Windows apps and Windows systems, while the .NET Core is a smaller cross platform framework for server apps, console apps, web applications, and as a core runtime to build other systems from.
- CLR – The Common Language Runtime (CLR), the virtual machine component of Microsoft's .NET framework, manages the execution of .NET programs. A process known as just-in-time compilation converts compiled code into machine instructions which the computer's CPU then executes.
- CoreCLR - .NET runtime, used by .NET Core.
- Mono - .NET runtime, used by Xamarin and others.
- CoreFX - .NET class libraries, used by .NET Core and to a degree by Mono via source sharing.
- Roslyn - C# and Visual Basic compilers, used by most .NET platforms and tools. Exposes APIs for reading, writing and analyzing source code.
- GC - .NET uses garbage collection to provide automatic memory management for programs. The GC operates on a lazy approach to memory management, preferring application throughput to the immediate collection of memory. To learn more about the .NET GC, check out Fundamentals of garbage collection (GC).
- "Managed Code" - Managed code is just that: code whose execution is managed by a runtime like the CLR.
- IL – Intermediate Language is the product of compilation of code written in high-level .NET languages. C# is Apples, IL is Apple Sauce, and the JIT and CLR makes Apple Juice. ;)
- JIT – Just in Time Compiler. Takes IL and compiles it in preparation for running as native code.
- Where is .NET on disk? .NET Framework is at C:\Windows\Microsoft.NET and .NET Core is at C:\Program Files\dotnet. On Mac it usually ends up in /usr/local/share. Also .NET Core can also be bundled with an application and live under that application's directory as a self-contained application.
- Shared Framework vs. Self Contained Apps - .NET Core can use a shared framework (shared by multiple apps on the same machine) or your app can be self-contained with its own copy. Sometimes you'll hear "xcopy-deployable / bin-deployable" which implies that the application is totally self-contained.
- async and await– The async and await keywords generate IL that will free up a thread for long running (awaited) function calls (e.g. database queries or web service calls). This frees up system resources, so you aren't hogging memory, threads, etc. while you're waiting.
- Portable Class Libraries - These are "lowest common denominator" libraries that allow code sharing across platforms. Although PCLs are supported, package authors should support netstandard instead. The .NET Platform Standard is an evolution of PCLs and represents binary portability across platforms.
- .NET Core is composed of the following parts:
- A .NET runtime, which provides a type system, assembly loading, a garbage collector, native interop and other basic services.
- A set of framework libraries, which provide primitive data types, app composition types and fundamental utilities.
- A set of SDK tools and language compilers that enable the base developer experience, available in the .NET Core SDK.
- The 'dotnet' app host, which is used to launch .NET Core apps. It selects the runtime and hosts the runtime, provides an assembly loading policy and launches the app. The same host is also used to launch SDK tools in much the same way.
Nice To Know
- GAC – The Global Assembly Cache is where the .NET full Framework on Windows stores shared libraries. You can list it out with "gacutil /l"
- Assembly Loading and Binding - In complex apps you can get into interesting scenarios around how Assemblies are loaded from disk
- Profiling (memory usage, GC, etc.) - There's a lot of great tools you can use to measure – or profile – your C# and .NET Code. A lot of these tools are built into Visual Studio.
- LINQ - Language Integrated Query is a higher order way to query objects and databases in a declarative way
- Common Type System and Common Language Specification define how objects are used and passed around in a way that makes them work everywhere .NET works, interoperable. The CLS is a subset that the CTS builds on.
- .NET Native - One day you'll be able to compile to native code rather than compiling to Intermediate Language.
- .NET Roadmap - Here's what Microsoft is planning for .NET for 2017
- "Modern" C# 7 – C# itself has new features every year or so. The latest version is C# 7 and has lots of cool features worth looking at.
- Reactive Extensions - "The Reactive Extensions (Rx) is a library for composing asynchronous and event-based programs using observable sequences and LINQ-style query operators." You can create sophisticated event-based programs that work cleanly and asynchronously by applying LINQ-style operators to data streams.
NOTE: Some text was taken from Wikipedia's respective articles on each topic, edited for brevity. Creative Commons Attribution-ShareAlike 3.0. Some text was taken directly from the excellent .NET docs. This post is a link blog and aggregate. Some of it is original thought, but much is not.
Sponsor: Big thanks to Raygun! Join 40,000+ developers who monitor their apps with Raygun. Understand the root cause of errors, crashes and performance issues in your software applications. Installs in minutes, try it today!