Blazor may turn my distaste for front-end development

posted by Jeff | Wednesday, October 14, 2020, 12:51 AM | comments: 2

Less than a month ago I started messing with Blazor, the WASM front-end framework bits shipping with ASP.NET, and after going a little deeper, I was cautiously impressed. Now I'm closer to genuinely impressed.

Here's the thing about front-end development in the general sense: It's largely built on Javascript, and then TypeScript bolted on top of it, and fed by a number of frameworks that have enjoyed varying levels of popularity in cycles, starting with Angular, then React and now Vue.js. Collectively, this has been fed by an insane network of package management fed through npm and various build-transpile-optimize-packing technologies like webpack that do work, except when they don't.

Back in the day of course, we used server-side technology for everything and liked it. Then we got sassy and did more stuff in the browser itself with jQuery. Then we all had so much bandwidth that server-side tech was plenty fast enough, but we went down the single-page-app route anyway. (Oh, somewhere in there, Flash and Silverlight died, too.) Before you knew it, we started using command line tools to seed a project and it pulled literally hundreds of packages down as dependencies. POP Forums, which is pretty light in terms of front-end tech (it uses Vue.js for the admin, SignalR for websockets, TinyMCE for text editing, and then dev dependencies for relatively simple minifying and transpiling of what little script there is), pulls about 433 packages down from npm, about 44MB, to build what results in about 38K of scripts and 7K of CSS.

I don't understand why everyone is still OK with this. It's like a house of cards when some random "package" that's actually 10 lines of code goes dark.

Anyway, I sucked it up and did a little Angular for a job like four years ago. I did some "hello world" in React. I really embraced Vue.js for the forum app in the relatively simple admin, and it requires no packages, just the library. So it is in fact possible to strip it down and not have all the dependencies to an extent. I've still not been crazy about the development environments for it all, though VS Code made life a lot better for sure. As a manager, I've seen how misuse of these frameworks can easily cause performance problems, and if you have to manage a lot of state, they can get sluggish.

To be clear, I've never been a big fan of any UI technology. Sure, I've been getting along with HTML and CSS for 20-something years, but the various technologies like Windows Forms, Java UI's, all of the XAML-based stuff, etc., have not been great.

So Blazor comes along, and it builds on top of the familiar HTML and CSS with C#, and compiles it to WebAssembly (WASM), a standard supported by all the browsers but officially not even a standard until last December. The ideas are familiar enough from the big three Javascript frameworks, where you can bind data across various UI elements and components and share state. Where it starts to get wild is that there is all this code out there built to run on servers that you can now run in the browser (image manipulation and reading tags out of files are examples I've already tried). The depth is crazy compared to what you can do with npm libraries. There are already a ton of component libraries. It's crazy.

I've been using Blazor on my music locker project, and I'm trying to iterate from "make it work" to "do it right," or my best understanding of what "right" is. I have some observations here and there about the way it works, pros and cons, but so far I'm finding it surprisingly easy to build things in a solid and component-based way that feels familiar to Vue, at least. The difference is that everything goes faster, because C# is less easy to get wrong and it's in the tooling I already use for all of the back-end foo. I've become productive fast enough that I even answered a question on StackOverflow (ironically about Javascript interop).

Is it going to catch on? Well, no tech lasts forever, but this one isn't really inventing something new. C# and HTML have been around for decades, and this marries them to run on a the fourth big W3C standard, WASM (the other three are HTML, CSS and Javascript). If developers start having an experience like the one I'm having, I think it will catch on. It's not a binary thing where it's this or the traditional frameworks, there's room for both.


Comments

Marin

March 29, 2021, 7:50 AM #

hello,

any thoughts on Blazor 6 months after this was published?

Thanks - Marin

Jeff

March 29, 2021, 5:09 PM #

Same as above. I haven't actively worked on it since November.


Post your comment: