Blazor: Is Javascript’s Beginning of the End?

Also available in portuguese

Blazor, the new Single Page Application of the .NET Platform, that you only write C# code and forget about all Javascript stuff.

Blazor: Is Javascript's Beginning of the End?

Before starting talking about Blazor, you need to know that I developed a lot of applications in the .NET Platform, like desktop applications, web, mobile, and also windows services.

I invite you to know my history working with the .NET platform clicking here.

I, as a .NET developer and C# specialist, after the MVP Conf LATAM 2019 event, and watched both Alexandre Malavasi’s and Antonio Maniero’s lectures, I decided to talk about Blazor, the SPA of the .NET Platform.

I am going to try to be more objective as possible, expressing my opinion as a mortal software developer.


# Before Blazor

When I started programming with the .NET Platform, I used WebForms dragging and dropping controls (TextBox, Dropdownlist) on a web page (ASPX) from the Visual Studio’s controls toolbox.

In that kind of application, we didn’t worry about javascript e didn’t know what was going on in the background of a WebForms web application.

The WebForms had all dirty work, rendering controls, and generating Javascript, HTML, and CSS to work on web browsers.

After that, Microsoft introduced other technologies like ASP.NET MVC, another developing design pattern that had separated frontend from business logic.

Different on WebForms, the MVC we need to worry a little bit with javascript and CSS. And, most of all, we had to organize all Javascript with some frontend design pattern, like the Revealing Module Pattern.

We used to reference some Javascript libraries like jQuery, KnockoutJS, and the built-in AJAX libraries of the ASP.NET MVC.

After the kingdom of the ASP.NET MVC, some Javascript frameworks came to help the performance and productivity of web development, they are AngularJS, Angular, React, and VueJS.

But, with these Single Page Application (SPA) framework, we still need to organize all javascript files, methods, and classes.

My point is: now, the Microsoft announces Blazor, where you develop in C# and let Blazor do the dirty work to make it work on all web browsers.

I know that Blazor is more than that, but did you realize what is going on? Sit, down, sit, down.

Blazor Razor


# Blazor, what we need to start?

Do you want to start programming with Blazor? So, get ready to install ASP.NET CORE 3.0 and some Blazor Visual Studio 2019 extensions.

The main goal of Blazor is that you don’t need to worry about Javascript and only develop using C# and Razor Views.

For those that already work with ASP.NET MVC and Razor Views, it is going to be a piece of cake.

Blazor: Is Javascript's Beginning of the End? 1

To start with Blazor, add a new ASP.NET CORE web application and chose the Blazor template from Visual Studio 2019.


# Blazor, where is my Javascript?

There are two types of Blazor web applications, one of them is Blazor WebAssembly, still in the preview version.

When your Blazor web application starts for the first time, the web browser downloaded all DLLs and, after that, your web application runs in the browser.

This concept is the Single Page Application, and to understand it, change the word DLLs to Javascript files.

But now the web browser understands C# DLLs?
Is it install the .NET framework in the user’s machine?
Do we need to install an extension to make it work?
And about my jQuery?

Take it easy.

WebAssembly is a technology supported by all modern web browsers (desktop and mobile) to run binary code, faster like the Javascript is.

If you want to start developing with Blazor now and don’t want to use the Blazor Web Assembly preview, you can choose the other type of Blazor web application, the Blazor Server App.

Blazor Server App runs at the server-side and uses SignalR to communicate between the web browsers. Amazing!

Also, with Blazor, you can call your Javascript methods using C# because Microsoft created JsRuntime interoperability.

var text = await JsRuntime.InvokeAsync<string>("ConvertArray", QuoteArray);

ConvertArray is a Javascript function that expects an array. Workaround? I still don’t know. I need to be more comfortable to talk about it.


# ASP.NET and #C# everywhere

It’s time to start to lose your Javascript phobia and start programming with C# because it is C# everywhere!

Now you can use Blazor without Javascript, and Xamarin Forms without knowing Android or iOS.

Is Microsoft trying to dominate all development platforms?

# But and about Angular, VueJS and React?

In my opinion, these guys will create some functionality to work with Web Assembly and, the fight for Single Page Applications will rise.

I bet that soon, we will write code in TypeScript and, without converting it to Javascript, it will convert it to Web Assembly format. Or something like that.


# Blazor: the past, present, and future.

The fact is that Blazor is already a reality.

The future only the Bidus know about it, but we can bet that Blazor will only rise with the .NET community helping it. And distinct, a significant investment, documentation and, publicity from Microsoft.

Of course, I am not prophesizing the end of the Javascript programming language, but from an ASP.NET developer point of view, would be the end o the Javascript?

That’s all for now. Thank you for reading it.

About the Author:
He works as a solution architect and developer, has more than 18 years of experience in software development on several platforms and more than 16 years only for the insurance market.