Blazor for SPA replacement

posted by Jeff | Tuesday, September 22, 2020, 11:45 PM | comments: 0

I was talking with a coworker about some goofy incompatibility problem that I encountered that the team had also experienced recently, and in searching for the issue, I noticed that we are in fact just two months out from the release of .NET v5. That matters because it means the open source platform formerly known as .NET Core becomes the only .NET, and that's exciting. It also reminded me that they have this thing called Blazor, which is essentially a way to target compilation to webassembly from proper netstandard2.1, and literally everything that runs on it. That's a big deal. It means client-side image manipulation and PDF manipulation and even my own existing code and rich libraries to do all kinds of stuff, in a browser.

I'm still so not-into the front-end frameworks. It's never been about the languages, Javascript and/or TypeScript, it's been the gigantic house of cards that is npm packages for everything and transpiling and packaging to ship it all. At a previous job, I watched how this resulted in a pretty nasty memory leak in a particular browser that was all kinds of bad news and expense. Even as I've gotten to know Vue.js, which generally feels lighter and easier to work with than React (and definitely better than Angular), it feels like I'm always up against the, "If only I could" problems that are limited by an interpreted language.

Anyway, I did some "hello world" experimentation with Blazor and I'm really impressed. There are a few weird things here and there when it comes to client-side file handling, but beyond that it works really well. I've read some real-world benchmarks about the size of the client-side assemblies and they slim down really well. It seems like a really viable alternative to using a JS framework for single-page apps. It looks like it can be used in the context of a progressive web app, too, which might be cool for the forums and maintained SEO.

There is a server-side version of the same thing, where it generates little DOM fragments and sends them down a websockets pipe, which is intriguing for the obvious forum use case as well. The problem there is that it may not scale very well, and having all of that chattyness between the browser and server means it won't be as responsive to user input as one would expect. I'll definitely do some experimentation though.

I've largely ignored Blazor since it was announced, but I feel like I need to look harder at it.


Comments


Post your comment: