Web Development future: C# instead of JavaScript

Everyone is talking about React, Angular, Vue.js and other JavaScript libraries and frameworks not just because they are a trend but also because they ensure a shorter development cycle, quick iterations and faster launch to market.

Probably, that’s why nowadays, we can’t imagine a dynamic modern web application without JavaScript

But , in September 2019, one of the big features included in the release of ASP.NET Core 3.0 was the ability to build rich interactive client-side web apps using Blazor – an open source web framework that lets you use C# instead of JavaScript for Web development.

I was quite sceptical at the begining, but of course “everything and everyone deserves a chance”. 😉

Without any doubt, Blazor offers us a lot of possibilities:
A better debugging experience
Dependency injection
JavaScript interoperability
Routing services
Unit testing
Supported on Windows, Linux, and macOS
….

But this is not everything...

Blazor can run your client-side C# code directly in the browser, using WebAssembly, or on the server using SignalR .
Blazor Web Assembly is still in preview. It will be released in May 2020 so if you’re considering using it, then maybe a Blazor Server will work better for you.

Whith a Blazor Web Assembly app , your dlls will be downloaded on the client side, which means that the download size is bigger and also if a user will be curious, then he can even take a look at the code inside your app.

In the context of latency, Yes, you can feel a delay in getting the response from the server every time you need it, so you must take into account that in order to build your infrastructure better.

For scenarios when your application doesn`t need to communicate with the server very often, it will be a great opportunitie to download the application and run it offline in a browser.

In terms of Browser Compatibility, of course you may have a problem with our good old friend : Internet Explorer because it doesn’t support WebAssembly. With the others modern browsers, it should work properly.

We can also have the possibility to work with reusable UI Components. You may want to try the UI components from top vendors like Telerik, Syncfusion, DevExpress, etc. but unfortunately they are NOT free.

If you want to create a new Blazor app, the setup process is very easy. You need to have installed the .NET Core 3.0 SDK (or later) and Visual Studio 2019 16.3 or later.

Also, if you already have an existing ASP.Net MVC project, then you can add and use at anytime Blazor for your client side.

The Startup class contains the same methods an ASP.Net MVC developer would expect, with just a few more extra lines of code:

in ConfigureServices method:

 services.AddServerSideBlazor();  

in Configure method:

app.UseEndpoints(endpoints =>  
    {  
        endpoints.MapBlazorHub();  
        endpoints.MapFallbackToPage("/_Host");  
    });  

Overall,  Blazor is definitely a framework worth to try, especially because Microsoft has big plans for its future. It’s going to change not only the Web Development experience but also the Desktop and Mobile development.

Published by

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s