Source: Scalable Path Blog

Scalable Path Blog What is .NET? An Introduction Microsoft's Framework

Back in the early 2000s, the applications built with .NET were aimed exclusively for Windows desktop and the framework itself was strictly developed and maintained in a closed source format. However, with the introduction of .NET Core, Microsoft made a complete shift and revolutionized software development. Applications could now be developed for a broader set of operating systems and platforms including Linux and macOS. Not only that, the development of .NET Core was made public with Microsoft sharing and receiving feedback directly on its GitHub set of repositories under the supervision of the .NET Foundation.Fast forward almost 20 years, we're now on the verge of .NET 6, which is expected to be released this November. It's going to somewhat "finish" the unification of .NET Framework with .NET Core all under the same umbrella of .NET - a long process that started with .NET 5.In this article, we'll explore the main features that make .NET one of the most popular platforms out there.What is .NET?To put it simply, .NET is an open-source software development platform built by Microsoft. It allows us to build cross-platform software products that can run on Windows, Linux, macOS, iOS, Android, etc. It's used for creating many different types of applications and services and provides the necessary programming environment for all software development phases. Its surrounding ecosystem is a great fit for businesses and individuals that want to develop a wide range of software products, from desktop and mobile apps to web apps and cloud-powered services.The History of .NET In the late 90s, Microsoft created .NET hoping to compete with Sun's Java, which was making a huge impact in the software development world. Envisioning a cross-platform development paradigm, Microsoft started incorporating the best brains in the market to develop its own software development ecosystem, going from desktop to the Web with Active Server Pages (ASP) and later on with ASP.NET, finally making the shift from on-premises to the cloud in recent years with Azure. Cross-platform is now something that we can take for granted when employing the .NET platform.As you can see, it's been a long road (almost 25 years) since its inception and that makes .NET rock-solid today. The following timeline depicts the main events related to .NET:For a more complete list, here's a detailed breakdown of events that lead us to the current state of .NET. .NET's Main FeaturesThe following list depicts .NET Framework main features:One framework, multiple languages: .NET introduces a Common Type System (CTS) that defines all possible data types and programming constructs supported and how these may interact with each other. This allows .NET to support multiple application development programming languages, including C#, F# or Visual Basic.CLR - Common Language Runtime: All the programming Languages in .NET are compiled into an intermediate language known as Common Intermediate Language (CIL). This intermediate language is not interpreted but compiled to native code in a way known as Just In Time compilation (JIT). The combination of these is called Common Language Infrastructure (CLI).Interoperability: Often, interaction between new and old applications is required. The .NET Framework provides a way to access features that are implemented in programs that run outside the .NET environment.Base Class Library: The Base Class Library (BCL) is a type library available for all languages that use .NET. The BCL provides classes that encapsulate many common functions, including reading and writing files, image design, database interaction, XML and JSON manipulation, etc.Security: .NET allows code to run in different levels of security without the use of a separate security mechanism.Automatic Resource Management: .NET CLR automatically manages memory, network, database connections, etc. It invokes built-in functions to allocate and deallocate the memory used by objects during runtime. This removes the burden of managing memory from the developer.Portability: Applications written in any .NET language are portable. That means that when the source code of a program written in a CLR compliant language compiles, it generates machine-independent, intermediate code. It's also possible to mix and match code written in the languages supported by the framework.Easy and rich profiling and debugging support: Integrated Development Environments (IDEs) like Visual Studio or Visual Studio Code provide a place to develop and debug .NET applications. The framework provides rich debugging and profiling information which is highly integrated within these IDEs. This helps us to check the application performance and track down runtime exceptions.Deployment made easy: When it's time for application deployment, the developer has plenty of options to package the app depending on the desired deployment environment (desktop, mobile, cloud, etc.)..NET's Common Language InfrastructureThe most important .NET component is located within the Common Language Infrastructure (CLI). The CLI's purpose is to provide an agnostic language platform for application development and execution, including but not limited to components for exception handling, garbage collection, security, interoperability, etc.The CLI implementation in .NET is called Common Language Runtime (CLR). The CLR is composed of four primary parts:Common Type System (CTS)Common Language Specification (CLS)Just-in-Time Compiler (JIT)Virtual Execution System (VES)AssembliesThe Common Intermediate Language (CIL) is hosted in partially compiled code libraries called .NET assemblies, which for a Windows implementation means a portable executable (PE), a file (EXE) or a Dynamic Link Library (DLL). These form the .NET distribution, version and security units.MetadataEvery CIL is self-described through metadata. The CLR checks the metadata to ensure the correct method is called. Metadata is usually generated by language compilers and also describes all the information about the assembly.Base Class LibraryThe Base Class Library (BCL) is available for all .NET languages. It provides encapsulation for the most diverse functions used by programs developed with the support of the .NET Framework..NET Programming LanguagesWhile it supports alternatives such as F# and Visual Basic, .NET's main programming language is C#.C# is a modern, object-oriented, and type-safe programming language that enables developers to build many types of secure and robust applications. C# has its roots in the C family of languages, which should make developers with a background in C, C++, Java, and JavaScript feel comfortable working with it.C# has these great constructs built-in:Generics, partial classes, anonymous types, iterators, nullable types, static classes, delegate interface.Implicit types, object and collection initializers, auto-implemented properties, extension methods, query and lambda expressions, expression trees, partial methods. Dynamic binding, named and optional arguments, generic covariance and contravariance, embedded interop types.Asynchronous tasks with async and await (task asynchronous programming model). Roslyn (compiler-as-a-service), exception filters, await in catch/finally block, auto property initializer, string interpolation, name of the operator, dictionary initializer.Tuples, pattern matching, record types, local functions.Using declarations, nullable reference types, async streams, null-coalescing assignments.C# is open-source and maintained at this GitHub repo, where new language features are developed, adopted and specified together with the Roslyn compiler GitHub repo. Roslyn is where the specification takes form and gets added to the language itself. It implements both the C# and Visual Basic compilers with an API surface for building code analysis tools..NET's Move to Open SourceToday both .NET and C# are open-source. I say today because this wasn't the case in the past, which made companies and developers stray away from it. When Microsoft began shifting towards open source in 2014, it opened the source of .NET Framework to promote its software ecosystem and stimulate cross-platform development.You can find its repositories at this GitHub page (currently, it has 197 repositories). These repos contain the source code that makes .NET cross-platform capable. It's maintained by Microsoft and the .NET community.In sum, it's a win-win game for everyone, as it allows ideas to be openly discussed with great minds scattered around the world. Once an agreement is achieved, implementation begins, followed by an exhaustive code review process. It's only after the submitted pull request complies with all the rigid code standards that the source code is finally integrated into .NET. Here's one contributing guideline from the .NET runtime as an example.Not only is new code appreciated, but submitting issues are also of great importance. Overall, GitHub repos make it easy to track the evolution of submitted code and issues. One interesting fact is that .NET consistently ranks among the top 30 most active open source projects since 2017, as tracked by the Cloud Native Computing Foundation.When we hover over the .NET circle in the chart above, we can see some great statistics about the entire open-sourced .NET on GitHub. In just 6 months we've had 56,000 commits, 33,644 pull requests and 1,507 committers:What used to take years to be implemented or fixed now takes weeks, months, or even days. All aspects of .NET are open source, including class libraries, runtime, compilers, languages, ASP.NET Core web framework, Windows desktop frameworks, Entity Framework Core data access library, and more. Not only the source code but the documentation is also open source.Help Documentation (Microsoft Docs)Every developer needs to check documentation to see how a given piece of code works, how the language construct is written, etc. Microsoft has been putting a tremendous

Read full article »
Est. Annual Revenue
$100K-5.0M
Est. Employees
25-100
CEO Avatar

CEO

Update CEO

CEO Approval Rating

- -/100