Why study C# Web Development

C# is one of the fastest growing languages in the industry, and most widely used, after Python, Java and JavaScript. It was released in 2000 by Microsoft. Having a big company developing and supporting the language is a big advantage, that’s why new features are regularly added. At the time of writing this article, the latest stable release of C# is 7.3 and the latest available preview build is version 8.0. Here are a few more reasons to choose C# for your.

Overview

Before we get into “why C#”, let’s ask the question “what is C#”.

C# is compiled, general-purpose, object-oriented, strongly-typed, imperative, declarative, functional, generic, garbage-collected, concurrent, WORA, component-based language. Peace of cake, right? Let’s go trough what I just said once again, just slower:

Compiled – there is a program that runs trough your code and translates it to something that computers can understand, in C#’s case, it is translated to an intermediary language called “Common Intermediate Language”. For advantages, read further.

General-purpose – this means that you can use the language for many different tasks such as making games, back-end development, front-end development and so on.

Object-oriented – this is a programming paradigm (pattern, standard) based on the concept of “objects”, which contain data, attributes and methods (functionality). They make programming easier once you learn them, because they allow you to manage your code more easily, make your program more flexible and allow you to write less code in the long run.

Strongly-typed – implies that once you declare (create) a number in memory and give it a name, let’s say “x”, you can’t change that number to the text “I love pancakes”, but you can still change the number to another number. This eliminates a whole ocean of mistakes that you can make by unintentionally using a variable, not knowing its type.

Imperative – means you use statements (commands) to tell the computer how to execute them and in what order.

Declarative – means you can also “express” the logic of a program without describing its control flow (opposite of imperative), example: we have a program that predicts weather, it works and in most cases we don’t care how it works.

Functional – represents the ability of the language to be used in a way to solve mathematical expressions instead of changing the program state and mutating data. In other words, the language can be used in math more easily

Generic – while strongly-typed forbids changing types, generic allows you to write code that handles all the types instead of writing code for each type.

Garbage-collected – while your program is running, all unused data and variables are deleted once in a while by a garbage collector in order to free up memory. This means you don’t have to deal with memory management, which is a problem for many people in other languages.

Concurrent – allows you to make a program to do more than one thing at a time and take advantage of multi-core processors.

And finally… WORA – “write once, run anywhere”, as the name implies, it lets you write code once and run it on multiple platforms without changing it. More on that later.

Now that we’ve talked briefly about C#, let’s get to the main point of this article – “Why C#”.

Speed

In this sense “speed” means not only how fast the language runs, but also how quickly you can code in it. One of the main winning points of C# is its ease of use. You’ve got languages like C++, Rust and Perl. With these, once you get beyond certain point, your code often starts getting hard to read. C# was created to be simple to read and write, allowing the programmer to do more with less code. The automatic memory management lets you spend more time implementing new features instead of having to deal with memory management. It comes at a cost, though – C# needs to have a garbage collector running, which introduces some overhead, more memory consumption than languages without one, and so on. Despite that, C# is a relatively fast language compared to some other languages in most cases. Good C# code is slower than good C++ code, but it can be written more quickly and read more easily, however, this is usually not noticeable as the difference is small in most cases. This makes C# more suitable for general use.

Multi-platform

A few years ago C# used to be for Windows only, running on .NET Framework. That changed in 2016 when Microsoft released .NET Core, which added support for Linux and macOS. .NET Core allows you to write multi-platform code. With the next release of C# (8.0), planned for 2020, Microsoft will make .NET Framework obsolete and will unify it with .NET Core under the name .NET 5.

Other languages offer portability due to being interpreted, but in their case this is done at the cost of performance.

NuGet

When you want to use a library (code that someone else has written) or a framework, with languages like C++, you have to download .dll files and put them in a folder, get .hpp files and put them in another folder, create a .cmake file… it gets complicated very quickly. C# makes this process very easy. NuGet is a package manager, that, simply put, checks its huge repository for these libraries and lets you install them with a couple of clicks.

Usage

As stated earlier, C# is a general-purpose language. It has wide a range of libraries and frameworks, allowing you to create almost anything with it from websites to desktop apps. It does that by utilizing technologies like ASP.NET Core, which is used for web development. ASP.NET Core is better than alternatives, because of its unique features. It is one of the easiest frameworks to get started with. It provides many outstanding security features like automatic out-of-the-box protection against most common attacks such as CSRF (Cross-site request forgery), XSS (Cross-site scripting) and SQL Injection. It has integrated dependency injection, a very advanced identity system, Web API support and so on. Speed is also a factor here. ASP.NET Core is the fastest, along with Spring.

If you want to make games with C#, the most popular way is through Unity, which is the most widely used game engine. Alternatively, you can use Godot, a new open-source game engine that supports C#.

Another popular framework is “Entity Framework Core”, which allows you to manage many different database systems with the same code. It auto-generates the tables for the databases and manages them respectively.

A very useful feature in C# is LINQ. Language INtegrated Query was the first of its kind and still is the one to get the new features first. Over the years it has become a standard that other languages follow.

Popularity

C# has been between fourth and sixth place in popularity in the past years. It is predicted that in the following years C# will surpass JavaScript in popularity and it will become as popular as Java.

Source: Popularity by language, GitHub (July 2019)

­­

Conclusion

C# is a modern language with many unique features and it is here to stay. Over the past few years it has become one of the most popular languages around.

If you are eager to start learning C# and want to become a successful developer, take the first step by applying for the Free Programming Basics Course from HERE.

Author: Teodor Zlatkov