Blazor – Build client web apps with C#
dotnet.microsoft.com
dotnet.microsoft.com
Dynamic by default languages are a mistake. Languages where anyone can monkeypatch anything are a mistake. Languages that are so flakey and squishy that the best tooling in the world can't tell you reliably whether a symbol is or is not defined somewhere in scope, and jumping to definition relies on grep, are a mistake.
I don't know if Blazor is the right answer - in particular the server-side version of it, using SignalR to send events and diffs back and forth gives me some chills and flashbacks to ASP.NET WebForms UpdatePanels... - but something better for WebAssembly will come soon, and we can finally be free of the sub-mediocre monopoly that JS has enjoyed.
Have you met TypeScript? http://www.typescriptlang.org/
Messy code is due to the programmer not the language. The idea that you can magically be a better programmer without spending time on learning and improving because you chose “a superior language” is silly.
Also we should be having this discussion in Latin. English is messy, you can write messy messages in English.
Come on, please. Of course you can write a steaming pile of trash in any programming language, but some languages allow you to do that more easily than others.
Comparing languages based on their absolute worst examples isn’t really a comparison at all.
Frustrating to see even the splash page off in lalala land.
Write once, deploy no where because surprise, the 3rd party package you were using requires a database connection, or some other server side feature.
This kind of messaging is why Blazor code is a mess; its not a seamless change to run on WASM when its ready, its server side lock-in, making db calls from your code behind file.
..and for anyone who thinks this isn’t webforms back from the dead:
> If you are a Web Forms developer and want to build a new application on .NET Core, we would recommend Blazor which provides the closest programming model. [1]
The sad thing is, the WASM c# end-to-end, using real full dlls in the browser is actually really cool.
...but somehow that got lost along the way.
[1] https://devblogs.microsoft.com/dotnet/net-core-is-the-future...
For getting smaller and internal projects done quickly and without stack drama, Web Forms does the job just fine. It's not going to win an art contest, but it's usually quicker, cheaper, and simpler than the alternatives. You wanna pay more for art and fashion? Go ahead!
The WASM side of it is really interesting for me as a Xamarin proponent, because it has the potential of true single shared-codebase between mobile and web. I'm not sure why I would use Blazor right now though.
That's not true. It can run client-side on a WebAssembly-based .NET runtime or server-side in ASP.NET core.
I find MS has generally been taking a Manhattan-project style approach these days, trying everything at once and keeping what sticks.
https://docs.microsoft.com/en-us/aspnet/core/blazor/hosting-...
I don't know if thats a disconnect in marketing, or me not paying attention, but like I said I was really confused.
But the reason they're pushing server-side Blazor is because loading client-side Blazor just takes too long in production deployments. Right now, you have to wait several seconds before the page loads, which is unacceptable for most users. I feel like server-side has to be the future, though, and they'll address the speed issue soon enough.
Otherwise, for many apps, server-side Blazor works just fine. The component model is like any other frontend framework, not like Webforms at all, and by running server-side gives you a shorter path to the data and backend code you would normally put behind an API interface. This is an incredibly productivity boost.
If you don't need or want it, then don't use it, but it's a major leap forward.
I suppose I could spend much of my day carefully vetting dependencies... but what about dependencies of dependencies?
There’s certainly a place for telerik—only UIs I suppose.
/shrug
JavaScript isn't really that big of a problem or a performance killer. The DOM is. I don't know what the answer is (rendering to a canvas tag is awful for accessibility) but I'm hoping that in time we see the improvement that is to the DOM as WebAssembly is to JS.
I know Paul Betts lurks around here sometimes (well maybe he used to, it looks like xpaulbettsx no longer exists), I would take his opinion on the two frameworks over anything I come up with.
Hopefully Blazor will avoid such issues. In any case I'm probably speaking out of turn... it clearly isn't designed for wide-scale deployments - in house/intranet tools are a different beast anyway.
I get disliking JavaScript, but there is a strong argument to be made for using the tried and tested technologies that developers have been using for a very long time, rather than shoehorning whole new tech in just because it's in a language you prefer.
With Blazor, this logic only exists in one place which helps follow DRY.Logic that is duplicated tends to get missed in testing often. This provides business value.
It's about prodding development teams towards the pit of success, to use a common cliche, instead of the pit of despair. Less mental overhead, less need for expertise in specific flavor-of-the-month frameworks, less churn, easier hiring (you just need to know C#), more reliance on compiler tools to prevent dumb mistakes.
Stuff like that easily make the difference between success and total failure. The business stakes are actually quite high.
HTML was originally intended for static documents. We have been shoe-horning it to act like a real GUI and faking state, and it's been grunting and groaning under the strain for 2+ decades. Give up already. Make CRUD Normal Again! #MCNA!
If you could use C# on both the front and back end, that would be a game-changer for enterprise shops, and very useful for everyone else too.
It was a very productive time, not sure if I have have ever been as productive as I was with C# and Winforms. Run code on the client, run it on the server, whatever.
Of course Elm isn't without its problems, too, but I think it may be on the right path for web applications.
Blazor is a game changer in my opinion. C# is a sold language and this project solidifies that.
I'm using QML, which is JS without DOM. JS is absolutely a performance killer. Migrating stuff from JS to C++ in a dumb way (no architectural change) makes things 20x - 200x faster.
What JS engine does QML use? Because if it's a relatively modern one (V8, JavaScriptCore etc) and you're experiencing huge slowdowns just creating and modifying UI components then I'd seriously question the JS code you're running.
I've written more React than most people, and am very intimately familiar with the internals, optimization and more.
With enough effort you can usually mitigate most of it, but I'm going as far as doing static compilation optimizations just to get it to feel good.
https://doc.qt.io/qt-5/qtwebchannel-index.html#
Is it possible to get any benchmarks or comparisons.
There's some good demos on their sites. The 'official' one could do with an update!
Though they all seem to provide basic controls like checkboxes, sliders, date pickers, etc. Shouldn't those be part of the core Blazor toolkit?
I tried making a game using blazor. Think something like the Jackbox TV games. A room gets created, then people join, and then play together real time (not a 3d game, something that could be done with html/css). It was surprisingly easy. Lots of things I did that I didn't expect to work did. There was pretty much no boilerplate code. I wasn't creating models on the backend and on the frontend, and then writing an api so that they could communicate. I didn't have to use JSON anywhere. I haven't finished the game because I started working on something else though, using flutter.
I don't expect people use JS on the backend to convert. Or people who have a ton of experience with something like React. But I think it is awesome. It removes everything I hate about web development. All of the other frameworks for web development that I have used have felt like putting makeup on a pig. Blazor felt like a step in the right direction.
It seems like the support from MS is there for now. You have to be aware of the limitations depending on whether you pick server or client side Blazor. I think the limitations are pretty insignificant for the most part though. I doubt Blazor takes over the web, but I hope that something similar will one day.
Cheers
We could, of course, make the thing that compiles and executes the code a shared plugin, but then we would have reinvented ActiveX and Java applets.
Last significant bit of news from it was the "official preview" phase, back in April.
If I understand it well, it WILL be released soon given that .NET Core 3 has just been released too.
The server side version is interesting, it ships DOM updates to the client from the server over a websocket (musch like OOUI https://github.com/praeclarum/Ooui). Not something that I'd use for production, but for quick internal projects which have the feel of a client side SPA, but while not requiring you to build the API layer it's quite neat.
WebForms 2020! Amazing.
Question: how will they go about shrinking them? Will this happen in the near future?
I've tried out Blazor before and the page doesn't load until you've downloaded everything. Will it always be that way, or will it be like JS eventually -- you see the page, and the JS loads in the background?
> With this newest Blazor release we’re pleased to announce that Blazor is now in official preview! Blazor is no longer experimental and we are committing to ship it as a supported web UI framework including support for running client-side in the browser on WebAssembly.