TechU Solutions

View Original

Give .NET Core and C# a Try

I started out learning to write code with the book Visual Basic Game Programming for Teens when I was young. Since then I’ve pretty much been using .NET my whole professional career, although 99% of my development has been C# as opposed to Visual Basic (barring one company that was still using VB long after Microsoft pulled the plug). I’ve always wondered when C#’s day would come, and for a while, it was looking like it was coming closer and closer. Throughout this article, I want to talk about the .NET space in general and why I think it may be coming back around and avoiding certain death. However, there are some hurdles that it has yet to overcome and the largest one has to be how tied it is to Windows.

The Issues .NET Core Solves

Up until 2017, .NET development could only be done on Windows machines and deployed to Windows environments. This is (was), by far, the largest flaw of .NET in general. There are several main reasons why this is such a big flaw, and why it’s still haunting .NET today.

Windows Licensing

You don’t exactly need anything special to develop .NET code, but if you want to deploy it to a production environment you’ll need a Windows server. You’ll also have to pay for the OS and all the licensing that goes into that. I purchased Windows Server 2012 back in 2015 and it cost me about $660 (USD) for a single license. If you’re a company you’re not just purchasing one license. While this may not be the biggest cost in the world, Ubuntu Server would have cost me exactly $0 and is much lighter and faster.

Docker/Kubernetes Compatibility

Docker was released in December of 2013, and it has been a game-changer in the development space. On top of Docker, Google released Kubernetes in July of 2015, a little less than 2 years later. I won’t get into the specifics of Docker or Kubernetes but you can read more about Docker here and Kubernetes here. All you need to know, in the context of this article, is that Docker gives your code a specific container, which is a lightweight stripped down virtual environment built on top of the Linux kernel, that will only run the code you give it. The beauty of Docker is that code will run the same on everyone's machine, solving the age-old “It works on my machine” debacle. The only downside is that it can be difficult to manage and scale a large number of containers.

Kubernetes was really the solution for this issue of container orchestration. With these 2 technologies, it became a breeze to spin up and manage your containers. The drawback, for .NET, is that these all assumed Linux compatibility as Docker only uses a lightweight Linux kernel. This made these incredible technologies inaccessible to .NET developers.

The Cloud

The first public cloud was release in 2006 by Amazon as Amazon Web Services (AWS). They started with their basic offerings: Elastic Compute Cloud(EC2) and Simple Storage Service (S3). Since then Amazon, Microsoft, Google, IBM, and quite a few other companies have scrambled to get their own cloud offering off the ground and provide continuing better services to their customers. Docker, Kubernetes, and Linux have fueled a lot of the cloud offerings, which also made many (not all) cloud offering inaccessible to .NET developers. Most cloud providers will allow you to spin up Windows Server virtual machines quite easily, but you’re still paying licensing fees and you still can’t use Docker or Kubernetes.

Visual Studio

I want to preface this section by saying, this is really my personal opinion based on my experience using Visual Studio on Windows. It is arguably one of the most powerful IDEs out there, but it has some serious drawbacks. The first of which is its size. Visual Studio will take up anywhere from 2–5 GB on your machine, which is a little egregious for an IDE. It’s also a huge resource hog, which can get taxing while you’re just trying to write some code. I remember working on a 60 some odd project solution and you could go get lunch and eat it before Visual Studio would open (my machine was brand new and had 32 GB of RAM by the way). If you had any 3rd party add-ons installed (which we did) just forget it.

Breaking away from Windows only

As I alluded to earlier, in August of 2017 .NET Core 2.0 was released, introducing cross-platform support for .NET. Now you can take your .NET development to Linux and Mac. They even released Visual Studio for Mac, and I have to say I’m impressed with it. I actually enjoy using the Mac version of Visual Studio more than the Windows version! They also released a really nice CLI to create and manage .NET projects of any kind on any platform you want to work on.

I have to give some serious props to Microsoft for making .NET cross-platform. Now all those things that were previously inaccessible you can feel free to use, and many teams are taking full advantage of it. If you’re like me and have previously left the .NET space because of the problems I mentioned, I would urge you to try out .NET Core 2.0.

It’s Familiar

Microsoft has done a fantastic job making sure that they didn’t change the C# language at all, so there isn’t anything special you have to learn. Simply install the dotnet CLI and runtime and you’re all set! It doesn’t even take as long to install. Then you can write the same old C# code you’re used to in the same way. One thing I will say is that if you have a project that is on the standard version you will have to convert some things, but it’s really not that hard at all.

If you’re just starting out and want to learn an awesome language, C# could be for you. The great thing is that even if you start out using .NET Core, you’ll be able to transfer your skills to .NET standard.

You don’t NEED Visual Studio

While I’m really enjoying Visual Studio for Mac, it’s not a necessity. You can use whatever general IDE you’re used to (like Visual Studio Code or Atom). The cool thing is that there are language plugins so you get all the cool things like code autocomplete and IntelliSense. However, none of those IDEs can really replace Visual Studio, as I said before it is extremely powerful and packed full of useful features, but it’s nice that it isn’t fully tied to Visual Studio.

The ghost of .NET’s past

As awesome as .NET Core 2.0 is, it is only about 2 years old. I have personally worked at plenty of companies who built these massive applications on top of .NET Standard and now don’t have the time or budget to transition them over. Traditionally, most .NET development has been done by companies who were pretty well tied to their Microsoft subscriptions and are now staring down the barrel of their legacy code.

I think there is a stigma around .NET because of what it used to be and many places are not adopting this technology because of it. I know that because I am one of the people who moved away from .NET to do more Go, Python, and NodeJS/TypeScript. I really didn’t think I would find myself looking back at .NET, but here we are.

Give it a try

Whether you are a new developer and you’re trying to figure out what best suits you, or you are a more seasoned developer looking for a new language to learn, I think .NET and C# are fantastic candidates for you. If you’re trying to build a large complex web application .NET MVC makes that amazingly easy. Their new CLI tool is an absolute breeze to work with and gives you the safety of hooking up all your code, creating boilerplate code, and making sure that everything is hooked up properly moving forward. It also works incredibly well with any front-end framework you happen to use right out of the box. If you want to build a native desktop or mobile app for ANY platform, .NET has you covered. If you only want to build an API or microservice, it’s a breeze. Visual Studio even has some tools you can use to automatically deploy your applications to the cloud.

I don’t think I could recommend the new .NET Core 2.0 and C# enough. Microsoft overcame some serious hurdles, and I think that this is a language that has excellent usage for any kind of program you’re building. I’m excited to get back into .NET and I’ll probably share my thoughts and experience along the way.

If you’ve enjoyed this article I’d love for you to join my mailing list where I send out additional tips & tricks!

If you found this article helpful, interesting, or entertaining buy me a coffee to help me continue to put out content!