Blog

Why .NET Core and C# are matters

For years I have read about polyglot programmers and how some new language was the new cool thing. Over time, it has been programming languages like Ruby, Python, Scala, Go, Node.js, Swift, and others. 

The problem with many of the existing programming languages is they are good at one use case. Ruby and PHP are awesome for web applications. Swift or Objective-C is great for creating iOS or MacOS applications. If you wanted to write a background service you could use Python, Java, or other languages. Besides C#, JavaScript and Java may be the only languages that can be applied to a wide set of use cases. 

It is hard for me to apply my skills to a broad set of problems if I have to learn many programming languages. It limits my job opportunities. The awesome thing about C# is the wide versatility of it that can be used for a wide variety of types of applications. Now with .NET Core working on MacOS and Linux, there truly is no limit to what you can do. 

According to the TIOBE programming index, C# is already one of the top 5 programming languages. 

Here are my insights as to why C# and .NET Core should be on the top of your list: 

Modern language feature –

.NET has been around a long time now and has steadily changed and improved over 15 years. Over the years I have seen awesome improvements like MVC, generics, LINQ, async/await, and more. As someone who has personally dedicated myself to the language, it is awesome to see it improve over time. With .NET Core, a lot has changed, including all of the ASP.NET stack being completely overhauled. 

Here are some the top features: 

  • Strongly typed.
  • Robust base class libraries. 
  • Asynchronous programming – easy to use async/await pattern. 
  • Garbage collection, automatic memory management. 
  • LINQ – Language Integrated Queries. 
  • Generics – List<T>, Dictionary<T, T>. 
  • Package management. 
  • The ability to share binaries across multiple platforms and framework

 

Scalability – 

C# is a statically-typed language, which means your code will be checked for errors before it gets built into an app. Errors will be easier to track down, and since statically-typed languages are also more strict with how you code something, the codebase, in general, will be more consistent and thus easier to maintain as it grows in size and complexity. 

As a statically typed language, C# is faster than dynamically typed languages because things are more clearly defined. Thus, when the app is running, your machine's resources will not be wasted on checking the definition of something in your code. 

Versatility: Web, Mobile, Server, Desktop –  

One of the best things about C# and .NET is the versatility of it. I can write desktop apps, web applications, background services, and even mobile apps thanks to Xamarin. Besides C#, all I really have to know is a little JavaScript (aided by TypeScript) to hack some UI code together (which I still try to avoid!). ASP.NET Core templates even make use of Bootstrap layouts and npm for pulling in client-side libraries. 

The versatility is a big deal because your investment in learning the language can be used for a wide array of things. Your skillset is highly portable. You can also jump from building web apps to mobile apps if you want to mix up what you are doing. This is a stark difference to most other programming languages that only work server side. 

And let’s not forget the first-class support for Microsoft Azure. It’s never been easier to get up and running and then deployed to the cloud in just a few clicks. Docker containers are also supported which makes it easy to deploy your app to AWS or other hosting providers as well. 

How .NET Core matters – 

  • Built & run on cross-platforms like Windows, Mac and Linux. 
  • New light-weight and modular HTTP request pipeline to handle a lot more requests.
  • Open source and community focused.
  • Single aligned web stack for Web UI and Web APIs.
  • Versatility: Web, Mobile, Server, Desktop.
  • A cloud-ready environment-based configuration system.
  • Built-in dependency injection. 
  • Integration of modern client-side frameworks and development workflows. 

 

Open Source -

One of the biggest changes to ever happen to .NET was the open sourcing of the code. Virtually all of the code is now on GitHub for anyone to review, fork, and contribute to. This is a huge change that most people in the industry never thought would happen.  As a developer, from time to time you need to look under the covers to see what your code is really doing. For example, in the past I once wondered if I called Dispose() on a database connection if that closes the connection or not. If you can access the source code somehow, you can quickly verify these types of questions. Even if you don’t contribute to the source code, you benefit from the huge community that is. Problems and improvements are quickly discussed, coded, and released for you to use on a regular basis. Gone are the days of waiting years for between releases for major improvements or minor bug fixes.  

Flexible Deployment -

One of the defining features of .NET Core is its flexible deployment — you can install the platform either as part of your application or as a separate installation. Framework-dependent deployment (FDD) is based on the presence of .NET Core on the target system and has many advantages. With FDD, your deployment package will be smaller. Also, disk space use and memory use are minimized on devices, and you can execute the .NET Core app on any operating system without defining them in advance. Self-contained deployment (SCD) packages all components (including .NET Core libraries and runtime) with your application, in isolation from other .NET Core applications. This type of deployment gives you complete control of the version of .NET Core used with your app and guarantees accessibility of your app on the target system. The unique characteristics of each deployment type ensure you can deploy .NET Core apps in a way that works best for your needs. 

Cross Platform-

This unique software platform already runs on Windows, Mac OS X, and Linux, as its cross-platform nature was one of the main priorities for its development. While this may seem like a strange move for Microsoft, it’s an important one in a technological world that’s increasingly focused on flexibility and segmented when it comes to operating systems and platforms. .NET Core’s availability on platforms other than Windows makes it a better candidate for use by all developers, including Mac and Linux developers, and also gives the entire .NET framework the benefit of feedback and use from a much wider set of programmers. This additional feedback results in a product that works better for all of its users and makes the .NET Core platform a move forward for software-defined, rather than platform-defined applications. 

Modular Development-

As part of its cross-compatibility design, the software development platform includes a modular infrastructure. It is released through NuGet, and you can access it as feature-based packages rather than one large assembly. As a developer, you can design lightweight apps that contain only the necessary NuGet packages, resulting in better security and performance for your app. The modular infrastructure also allows faster updates of the .NET Core platform, as affected modules can be updated and released on an individual basis. The focus on agility and fast releases, along with the aforementioned collaboration, positively positions .NET Core within the DevOps movement. 

GruntJS, NPM, and Bower Support -

Front-end development gets a lot of love in ASP.NET 5 through its support for GruntJS (and eventually Gulp). 

GruntJS is a task runner that enables you to build front-end resources such as JavaScript and CSS files. For example, you can use GruntJS to concatenate and minify your JavaScript files whenever you perform a build in Visual Studio. 

There are thousands of GruntJS plugins that enable you to do an amazing variety of different tasks (there are currently 4,334 plugins listed in the GruntJS plugin repository): http://gruntjs.com/plugins 

For example, there are plugins for running JavaScript unit tests, for validating the code quality of your JavaScript (jshint), compiling LESS and Sass files into CSS, compiling TypeScript into JavaScript, and minifying images. 

In order to support GruntJS, Microsoft needed to support two new package managers (beyond NuGet). First, because GruntJS plugins are distributed as NPM packages, Microsoft added support for NPM packages. 

Second, because many client-side resources – such as Twitter Bootstrap, jQuery, Polymer, and AngularJS – are distributed through Bower, Microsoft added support for Bower. 

This means that you can run GruntJS using plugins from NPM and client resources from Bower.