My first experiences with C# and .NET
I was introduced to Microsoft’s .NET framework during my first full-time programming job. I didn’t think much of the language at the time, and counted on a shallow learning curve given C#’s reputation of being ‘just like Java’. Unfortunately, as I would come to learn, it was a bit more different than I’d hoped.
Although I did a couple of C# tutorials before starting the job, actual C# code looks nothing like the entry level tutorials I saw plastered all over the internet. Unbeknownst to me, there were things lying in the code beyond my wildest expectations. Concepts like ‘Attributes’, ‘Delegates’, and ‘Assemblies’ were forced into my life — blowing away any misconceptions of the language being ‘just like Java’. This wasn’t Java, that’s for sure.
The C# code I was reading actually seemed more reminiscent of Javascript than Java. in fact, all the ‘var’s and arrow functions had me constantly re-checking the extensions of the files I was working on. That’s not to say Java didn’t have it’s influence on C# (I mean it was originally a C# clone!), just that the similarities to Javascript stood out to me more in the beginning.
Like Java, everything has to be in a class, with the program starting point being a static method titled ‘main’. Additionally, C# is also executed as managed code within a runtime environment just like Java’s bytecode running on the JIT compiler. Because of the striking similarities of the two languages, just this once, I could excuse the interchangeability of ‘Java’ and ‘Javascript’ in the discussion of C# language comparisons.
Besides the language, one of the most confusing concepts for me was the difference between .NET and ASP.NET. As I’ve now learned, .NET is the system-level framework that contains the required libraries and runtime environment for Microsoft’s managed code. ASP.NET is just the high level software library for developing web applications inside that runtime environment.
What made this so confusing for me was the lack of information on whether a version of ASP.NET (being just software libraries) could be run on multiple .NET framework runtime environments, or if it was software built in (and integrated) to the .NET framework itself. I assumed ASP.NET was packaged within the .NET framework initially, but with the release of the latest version of ASP.NET (Core) as a standalone software package, I couldn’t be so sure.
At first, I couldn’t find anything online that could answer this question, but after reading pages and pages of Microsoft documentation I found a sentence that confirmed my suspicions. Previous versions of ASP.NET were in fact packaged and versioned alongside the .NET framework releases and could only work within the runtime of the framework from which it was released. With the new implementation of ASP.NET, the software libraries can be decoupled from any single .NET framework version and could run on multiple versions of .NET’s runtime environment.
Listed with each version of ASP.NET Core is a version of something called the ‘.NET standard’, another concept that confused me in the beginning. What I’ve come to find out is that each version of the .NET standard is basically just a list of different Microsoft frameworks. The version listed for any specific framework in the .NET standard represents the earliest version that can be included as part of that version of the .NET standard. When there’s a .NET standard version listed next to a specific version of ASP.NET Core, it represents the earliest set of framework releases that will support that version of the ASP.NET Core library.
What made these concepts the most confusing is the misleading relationship between the .NET Core framework, and ASP.NET Core. As I said previously, any specific version of ASP.NET used to be packaged within a .NET release. Additionally, any specific version of ASP.NET could only work with the version of the .NET framework it was released with. As a result of this previous paradigm it would seem reasonable that ASP.NET Core would only work on .NET Core but, this is not the case.
Although ASP.NET Core shares the naming convention of ‘Core’ with .NET Core, it’s libraries are not being forced to work with the .NET Core framework. Even though the .NET Core framework WAS made to be a new, ground up, and different implementation of past versions of .NET, somehow the ASP.NET Core libraries are not restricted to only running on the newest version of .NET.
After all of the confusion has been cleared up, I could finally understand how to start using the .NET framework and associated libraries. Though I knew I’d have many more chasms to jump before coming to a comprehensive understanding of Microsoft’s web application architecture, I at least had solid footing on which to jump from.