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

Custom Software Development | Done Technologies

Industry 4.0 and Internet of Things

The concept of the Internet of Things (IoT) is basically very simple. Sometimes we also talk about Industrial Internet of Things (IIoT) for the industrial sector. The idea is simply to connect physical objects to the digital world through the Internet. It gives these objects their own digital existence. But Why? Initially, it’s essentially about...
Custom Software Development | Done Technologies

Microservices: an Agile architecture

The digital era in which we live nowadays requires us to bring several changes to our way of doing things. Businesses that are still seeing software development as a costly burden and not as a strike force, will soon face many important challenges. To surf on the technological wave, businesses need to be able to...
Your Custom Software Creation Partner | Done Technologies

The value of the Event Store’s events (part 2)

In the previous post, we saw how to create events based on commands. Why not update the database directly? Why do we need to go through an Event Store? Let’s talk a bit about the current situation… Currently, the majority of systems keep their data in a relational database common to several information systems. The...