How many ways to create a web app do you know? Dozens. I believe that with Blazor from Microsoft, you won’t need anything else. Almost. Using Blazor for web applications is efficient and fun. Before you start your first Blazor project, let’s check some basics.
Let me introduce myself. And Blazor.
Hi! I’m new here, so please, be kind. Think of it, that’s true for both me and Blazor. First things first. It’s a bit awkward introducing yourself and not making it braggy, isn’t it? Shortly then. My name is Paweł, and I’m a .NET fanboy, .NET enthusiast, .NET explorer, .NET senior developer. Basically, we can talk about .NET. I’ve been building desktop and web applications for quite a while now, way before Blazor was a thing. Fancy version – I strive to be a Full-Stack .NET developer. With Blazor. It all started back in 2018 when it was first released. Building web applications changed for good. And I haven’t doubted that it was a good decision.
The new Blazor series starts now
This article starts the Blazor blog series. I gotta warn you, though, that currently, it’s my favourite framework to work with, and I just might make you dig it too. Like any worthwhile relationship, we’re going to start slow.
- Getting to know each other – what is Blazor, what challenges does it solve and what could it do for you. How can it help you with web apps development?
- First date – should you consider taking the Blazor train into the future. Actually, why should you and what benefits are waiting for you?
- Testing trust boundaries – is Blazor testable and could be a robust choice for your projects? Is Microsoft’s solution good enough for your company?
- Moving in together – keeping Blazor code clean and solutions in order. How will it earn more money for your business?
- And then it gets serious – we’ll take a look at Blazor architectures, relations with .NET APIs, the new fancy .NET Minimal APIs included, performance improvement tricks, and many more.
Enjoy the ride.
What is Blazor?
Technically, Blazor is a free and open-source web framework for web apps. It’s been created and developed by a team at Microsoft 3 years ago. If you’re brave enough, the actual source code can be found here. The hype behind it comes from the fact that it uses C# instead of JavaScript to work with a browser. What’s the benefit? It allows you to use the same syntaxes and semantics for both backend and frontend. One programming language for UI components and the code behind them.
Practically, it doesn’t mean you’ll be able to stop using JavaScript entirely. At least not yet. But it can be heavily limited to necessary cases. Considering that both client and server code is written in C#, those libraries, models, and services can be shared. Combining that with HTML and CSS could make any .NET developer a web-app powerhouse, and a team of those – a highly effective factory.
How does Blazor work?
There are two ways to use Blazor, as of now, but big things are coming in 2022, so stay tuned. The hosting models are:
- Blazor Server – side is running on your server and uses SignalR connection to exchange only UI changes and events with the browser. Simply put – the server will respond to the events arriving from the user with only those parts of UI that were affected by them. Working on UI compartments makes it fast, efficient, and cheap to exchange information.
- Alternatively, Blazor Client-side is running almost entirely inside the user’s browser. To make that possible, C# code is compiled into WebAssembly. In that case, accessing the page means also downloading a full Blazor app. It might get heavy and risky (you will see a more thorough analysis in an upcoming post, so follow along!). On the other hand, it also means that, if built properly, your Blazor apps can be run offline.
Both server-side and client-side solutions have their advantages. Choose whatever you need for your Blazor project.
Why should you even bother?
Well, if you create code – especially a C# code – that’s self-explanatory. Using Blazor means less to no JavaScript headache. Nothing more has to be said. If you manage a .NET team – now is your chance to easily dive into full-stack web development.
If you’re a startup founder, you’ll likely welcome smaller, more agile and efficient development teams. As an owner of an established business – you’re going to see Blazor more often, as the adoption curve is greatly accelerating, and you’ll probably wonder why haven’t you considered that technology earlier. The efficiency and safety of Blazor based web apps can, and will be, a competitive advantage.
If you work in marketing and want to take your processes to the cloud, if you’re in data analytics and need an efficient and user-friendly cloud front desk, if you’re a seller of goods or services looking for a secure, efficient custom solution – Blazor meets all those needs.
Do you want to learn more about Blazor now?
More posts are coming in this series, so I’d appreciate it if you follow along. I’ll cover Blazor projects, using C# instead of JavaScript, building web apps, and much more.
But if you’re already hooked or ended up here looking for MS Blazor support and a team that will face your challenges, we got you covered. Just drop me a line and let me know what you need.
Q: Why should I use Blazor?
Blazor allows for efficient and agile development with a C#-based codebase, reducing the need for JavaScript. It also allows for full-stack web development with a .NET team. Startups and established businesses can benefit from its ability to create smaller, more efficient development teams.