Web development: Why Blazor is the ideal framework?

By Bruno Barrette

Blazor. In early November 2018, when it was still an experimental product, I was talking about Blazor at an event we had organized at our office. By the way, I had surprised many colleagues when I revealed at the end that my PowerPoint presentation had been prepared with Blazor. I followed the evolution of this experiment, which became officially a product in development, until it was launched in WebAssembly version in May 2020. This was followed by a talk at Blazor Day in June, which I presented on 3 other occasions in the same year, a few episodes of the Bracket Show on the subject, plus a full-time project since last June. Oh, and I keep nagging my colleagues about how wonderful Blazor is and why there are so many benefits in using it. So I wanted to share why I think this technology is a great revolution, but without getting too technical (I’ll leave that aspect to the Bracket Show).

Blazor. At the beginning of November 2018, when it was still an experimental product, I was talking about it at an event we had organized at our offices. Incidentally, one of the powerpoints for the event had been made with Blazor, I had surprised many when I unveiled the punch at the end.

Since then, I’ve been following the evolution of this experiment, which became a product officially in development, until it was officially launched in its WebAssembly version in May 2020.
This was followed by a talk at Blazor Day in June, which I presented on 3 other occasions in the same year, a few episodes of the Bracket Show on the subject, plus a full-time project since last June. Oh, and back then, I was just badgering my colleagues about how wonderful Blazor is and why there’s nothing but gains to be had from using it.

And the good news is, in November 2023, Microsoft will be releasing a new Blazor version, currently named “Blazor United” , which combines the benefits of “Razor pages”, “Blazor Server” and “Blazor WebAssembly” into a single framework. A way for Blazor components to become a single architecture for all your Web UI scenarios, meaning that you’ll be able to easily switch between different rendering modes and even mix them in the same page.

In this article, I’d like to share why I think this technology is such a revolution, but without getting too technical (I’ll leave that to what we do with the Bracket Show).

What is Blazor?

First of all, for those of you who don’t know Blazor at all.

Blazor is a framework for developing single-page web applications using C# only. You can still use JavaScript, but it’s no longer the main language as with popular client-side frameworks such as Angular or React. And unlike what some people experienced with Silverlight, no plug-ins are required at browser level thanks to WebAssembly, an open web standard that allows binary code to be executed in the browser.

In other words, the code compiled for our application is executed as is in the browser, not transformed in the same way as TypeScript, which is ultimately JavaScript once transpiled. So we come to the next question: why is this so interesting?

Avoid mistakes with one programming language: C#

The first thing I find interesting is the fact that we’re working on a single programming language. I’ve got nothing against working with different languages on the same project, but I do think that working with a single language increases our productivity (when it’s a language we’re comfortable with, of course). With Blazor, a full-stack developer no longer needs to know multiple frameworks; if he knows C#, MVC, ASP.NET, he already has almost everything he needs to do Blazor. Of course, you have to keep up to date from a technological point of view, learn new languages, try new things. I wouldn’t be here talking about Blazor if I hadn’t done so. On the other hand, in the sense that a framework is a bit like a toolbox, if I have the choice between bringing along a single box containing tools I’ve mastered very well, versus two boxes, one of which contains things I’m less familiar with, my choice is going to be towards the one that gives me a better return.

 Avoid code duplication…again

Finally, another important point in favor of Blazor is code duplication, or rather the elimination of it. Throughout my career, which started in Windows applications with VB6, I was hammered with the idea that you should avoid duplicating code. “You should extract a function to avoid duplicating code”, “You could use polymorphism to avoid repeating code that is common to your objects”, and so on. Until the day I came across a project with the server side in C# and the client side in Angular with TypeScript. Then I started to hear sentences like this:

“For your model that your API exposes, you’re going to have to make an identical object on the client side. And don’t forget to update it when you modify it”.

“The validation must be done on the server side. On the other hand, we should also redo the same kind of thing on the client side so that the user can’t enter just anything.

So we ended up duplicating code, an action that we’ve been banning for years! It didn’t make sense in my head, and of course this kind of thing adds a risk of forgetting a change, which we’ll do again only when we try our application. With Blazor, this concern simply disappears. Blazor allows you to share libraries between the client and server side, so you can easily centralize your communication objects between client and server as well as things like validation. No need to repeat, we increase our productivity, standardize behaviors, reduce our risk of errors and especially avoid having to maintain the “same code” twice.

Blazor will change web development

I hope that this point of view on Blazor will have interested you, maybe it will even have given you the desire to try it. One thing is certain, Blazor is not just passing through, it is here to stay. Many efforts are currently underway to make it the language of choice for web, mobile and desktop applications, so if you develop using C#, the chances of you doing Blazor in the next few years are very high.

If you want to know more, don’t hesitate to read our other articles on Blazor or to discover our videos on our Youtube channel Bracket Show.

Discover also our projects as well as our custom software development services.

To follow the launch of the new version of Blazor in November 2023, click here.

Autres articles qui pourraient vous intéresser

Imagine a world where the past is the only truth… all the truth (part 1)

Your computer systems surely contain several structured and relational databases. You must regularly make copies to avoid losing information. Despite these precautions, you lose all the intermediate states (system states after a past event) of your information systems. If all you are interested in is the final state, it is not too serious. However, it...
Our Success Projects | Done Technologies

Hello World entreprise version

Basic Hello World The best way to learn a new language is still writing the typical Hello World application. I can not count the number of times I started a new project with this simple application. For example here is the simplest Hello World application that can be done in C#: After starting Visual Studio and...
Software Development Expertise | Done Technologies

Spike and Emergent Design

There is a technique, initially introduced by the Extreme Programming movement, which consists in adding an element to the product backlog that we call a “spike.” The team agrees on a limit of time to be invested in this item. The goal is to acquire the knowledge necessary to reduce the risk, understand a requirement,...