.NET 8's Best Blazor is not Blazor as we know it
servicestack.net
servicestack.net
Anyone actually using Blazor in production? How's the effective performance/responsiveness? Are the loading times reasonable? Is this usable on low end and mobile?
https://news.ycombinator.com/item?id=38363704
I wouldn't touch the WASM mode with a 50 foot fiberglass pole.
For me, Blazor was a great entry point. I still use .NET for everything, but now we mostly use simple form posting with string interpolated vanilla HTML responses directly to HttpContext.
There are no more frameworks in our shop, but I don't think we could have arrived at this point without things like Blazor, Angular, RiotJs, et. al. temporarily bearing the load of our ignorance until we (or the technology standards themselves) could finally pass through.
The web in 2023 isn't like the web in 2017. I think you could start completely blank on vanilla MDN and PHP-style web dev and arrive at an extremely happy outcome. No blazor, no react, node, nothing. Confidence that the javascript or CSS will "just work" 99.99% of the time is there for me now. Avoiding premature optimization regarding UX edges (i.e. justification for SPA) and backend technologies are the major remaining challenges. Chasing a pixel-perfect, cross-platform UX is how you wind up with absolutely nothing to show for it at the end of the day. I blew about a year of my life on that one.
"I think you could start completely blank on vanilla MDN and PHP-style web dev and arrive at an extremely happy outcome."
Yep
EDIT: I’m not a web dev, the web is just the most consistent UI platform for supporting mobile and some desktop we have now so that definitely influences my opinion.
Edit: I guess there is supposed to be [0] I can't imagine it that would actually be any easier than moving to any other technology.
[0] https://learn.microsoft.com/en-us/dotnet/architecture/blazor...
There is even a .NET Conf 2023 session regarding it,
"Bye ASP.NET WebForm, Welcome Blazor"
JS does have its own gotchas, so I guess there's something to that... But I can't imagine building things for the web without a solid foundation in html, css, and js.
Hard to imagine web development without Javascript now, but with work of projects like this, maybe it will be easy to imagine web development without Javascript in 10 years time.
To start? This is not new. We've been down this road a dozen times.
If you're going to have a separate backend, .NET has some advantages compared to Node that's worth considering. It's higher throughput than Node for the same compute resources, it's multi-threaded and you can run background workers in-process, it has some nice built-ins for concurrent processing (Task Parallel Library, System.Threading.Channels), the nuget ecosystem is less prone to security risks compared to NPM [0], EF Core is a really mature ORM and possibly one of the best ones out there for productivity, it has serviceable hot reload for productivity, and modern C# is really, really close to JS and TS in syntax [1].
One often overlooked advantage for high security contexts is that .NET has a large standard library that's maintained by Microsoft for really core things like encryption, hashing, database drivers, network code, etc. You get the benefit of having an army of professional engineers maintaining that core code and patching it when security issues arise versus the Node/NPM ecosystem's strong dependency on the community.
C# and .NET are the backend runtime that most teams probably want when they think of moving on from Node to Elixir, Go, or Rust because of how close it is to TypeScript now.
And if you're going to use .NET on the backend, then why not consider Blazor for SSR and static HTML?
(Disclaimer, I'm not a big fan of Blazor, but I can see why teams would choose it).
[0] GitHub State of the Octoverse 2020: https://octoverse.github.com/2020/static/github-octoverse-20...
C# and .NET are the backend runtime that most teams probably want when they think of moving on from Node to Elixir, Go, or Rust because of how close it is to TypeScript now.
Bold statement. Looking like typescript doesn't seem like it should be the most important concern in a backend lang.Similar syntax equates to similar constructs and concepts. The way async/await works -- from a dev perspective -- is the same. Exception handling is more or less the same with try-catch-finally. Lambda closures work largely the same (some differences due to how JS binds `this`). TypeScript object hierarchies like interfaces and abstract classes are more or less identical in function (obvious differences, though in underlying implementation and capabilities). Same null coalescing, same nullability constructs. Array methods like `map`, `filter`, and so on are subset of System.Collections.Linq operations like `Select`, `Where`.
Certainly having similar syntactic language constructs makes it easier to adopt if you are already comfortable with try-catch-finally and async/await versus entirely switching paradigms in Go or Rust, for example.
Tooling is very similar from a CLI perspective and DX isn't that different. Hot reload, .csproj = package.json, main.ts or index.ts = Program.cs
Low platform churn, i.e. Blazor has essentially kept the same development model for 5 years, uses the same MS Build/.NET SDK and Framework libraries that are actively supported by Microsoft. Whilst the JS/FX landscape see's frequent fragmentation, new incompatible major versions, new module loaders, new build tools, 100's of deps which are often abandoned/incompatible after upgrades, etc.
Blazor SSR App's gives you SPA-like responsiveness to traditional SSR Apps by default, i.e. without needing to manage decoupled client routing, complex state, npm deps, build tools, large JS blobs, etc.
Blazor makes it very easy to create encapsulated reusable components, which already sees a large number of 3rd Party component vendors available for it.
The .NET Platform overall is very performant, works flawlessly cross-platform, C# is a very IDE-friendly statically typed language with great tooling e.g. JetBrains Rider is one of the best IDE's available for any language and works cross-platform.
I guess if you really want to, you can do a lot with tuples and if you need the equivalent of object literals and spreading, you could use records ... both options with fairly minimal additional effort over what you would have written in TypeScript.
On a positive note I bought my house with the money earned by their lack of attention.
E.g. React Hooks, Next.js 12 to Next.js 13, Vue 2 Options -> Vue 3 Composition, etc. NPM is a whole other issue.
The one constant in FE is JavaScript and now TypeScript. Likewise, the one constant with .NET's FE stacks is C# which has remained quite stable and in many ways influencing JS and TS. C# had had async/await and Lambda expressions before JS (not clear not me how much effect Microsoft had on ECMA working group's decisions).
Silverlight was their one big snafu, but even that was kept alive for quite some time.
Those of us that had a go at ASP, ASP.NET, ATLServer, ActiveX, Silverlight, WebForms, AJAX Control Toolkit, WebAPI, WebAPI 2, MVC, Core MVC, Razor Pages.
I'm not even sure why you're counting WebAPI in there since it's for writing REST APIs.
The graveyard of Node and JS technologies is orthogonal to the current burnout feeling in many Windows circles regarding Microsoft technologies.
To the point that, as I already mentioned a few times, I happened to do .NET Framework to something else ports, instead of the more rational migration to modern .NET.
You see the same in long time well known Microsoft partners like Sitecore, moving away from .NET.
Technologies change all the time in every stack; flavors come and go.
By the standard of the web JS ecosystem, .NET has been relatively stable.
I don't care what others do.
It is like kids on the kindergarten playground, arguing for who behaves better.
Same thing with most of Windows GUI frameworks MS built. They all use same rendering language/interface (xaml).
Doesn't matter how long they have been supported.
If by "They all use same rendering language/interface (xaml)." you mean a XML based file format to describe the GUI layout, you are right.
If on the other hand you mean a GUI description language that is compatible with zero code changes, then not really.
The Windows GUI tools definitely seem to be struggling. Developing native desktop apps is much rarer these days, so all the attempts to create a single toolkit for multiple form factors makes some sense. But that is actually really hard to do, and Microsoft is starting from behind when it comes to mobile frameworks.
FWIW, the last time I developed a native desktop app was WPF. I tried again recently, but my general takeaway was that you need full Visual Studio still to make it work.
To the point that many might still use Windows, but not necessarly Microsoft frameworks.
(1) Try how a default OK/Cancel WITH LAYOUT can be expressed in your idiom. If it looks ugly and convoluted, fix your design until you don't have that problem. (2) Try how a 'tools on the sides, resizable work area in the middle' works in your idiom. If it sucks, see (1). (3) Check how margins and borders are controlled and defined in your idiom. If it requires repeating '10px' 480 places all over your source, see (1). (4) Check if evenly spacing/sizing a bunch of similar components requires special handling for first or last element, again, see(1). WPF fails all of these, and several more.
Winforms especially is going on 20ish years?
How do you feel burned by them.
Given the mindshare iron grip Microsoft has over .NET ecosystem, it's able to dictate the Web Framework that most of .NET will use - which is now Blazor.
But now that Blazor SSR with Enhanced Navigation offers an optimal UX out-of-the-box, Blazor's going to become the only real future option for Web Development in C#/.NET. I wouldn't have considered it (for Internet App's) before .NET 8, but now its basically the only real future choice for creating any kind of new Web App in .NET (excl. CDN Hostable, SSG Websites).
Also your last point is quite frankly crack smoking. You can still dump out perfectly good dynamic content with Razor and MVC.
Silverlight's demise was inevitable along with the death of Flash and WebForms is a 20+ year old technology that was focused on retaining a Desktop App development model for the Web, an inferior abstraction which would have never lasted. Blazor is unlike either and delivers a great UX OOB.
> You can still dump out perfectly good dynamic content with Razor and MVC.
and you always will be, Blazor just has a superior component and development model, an official API for statically rendering components outside a Web Framework context and will eventually be what most of .NET will be using.
Feel free to use whatever makes you happy, we still heavily use Razor Pages + SSG for our (CDN hosted) statically generated websites + docs, but will be predominantly using Blazor for new .NET Web Apps.
On the other had MS gave Silverlight 10 years of support when they announced the death of the tech, MS couldn't do anything else about it. If they waited long enough they could have ported silverlight to wasm today. I think there was a company offering dev tools for compiling silverlight to js and wasm, not sure if they are still around.
MS has had a storied past when it comes to frontend tech, but rather than diverging and dying, what we seem to see now is convergence of a coherent technical vision (and some pruning as a result). They look the same on the surface, but the result is totally different.
The latest version achieves exactly what every strung-together implementation of a moderately complex SPA architecture has aimed for in the past decade: fast initial render, low latency interactivity, low server load.
They did it in a way that still plays moderately well with the existing JS ecosystem.
They did in in a way where everything you do can be airlifted to the desktop or mobile via MAUI Blazor Hybrid.
And some of the underlying pieces that are coming along to make this possible are incredible. (Go check out some of the stuff they're doing in the wasm/WASI space.)
That said, I personally wouldn't choose to build on MS tech.
Microsoft gave us TypeScript. I can't think of front-end tech with more care and attention given to it than TS. For over ten years!