10 ms·
Blazor – A .NET web framework that runs in the browser with WebAssembly
- math 8y agoIn Blazor, what is sent to the browser is a .NET runtime, then the .net assemblies (which are .NET CIL, not wasm) which the runtime executes. They seem to have this working well, but it's less efficient than, for example, Rust which has no runtime and compiles directly to wasm. C# is very much my goto language, but my eye is currently on Rust in this space because the scenarios where I feel the need for something other than Javascript in the browser are all performance related - i.e. I find React / JSX great for working with the DOM.
- deleted 8y ago[deleted]
- martinald 8y agoI'm wondering that if WebAssembly could "cache" these runtimes, so you only have to download once? I can see Blazor being really useful for back office systems where people are in them for hours, not so much customer facing stuff which people are dropping in and out of. I think anything that can challenge JS (which tbh is looking increasingly more like C# with every new release) on the front end side can only be a good thing though.
- scarface74 8y agoI am a huge fan of C# and it’s bern my go to language for over a decade, but at this point in my career, I am not tying my horse to anything MS. MS just doesn’t seem to be gaining the mindshare with green field initiatives or smaller companies that are focused on all things JavaScript. On the other end, large enterprises are still more tied to Java than C#. Yes that makes me sad. The only thing that Microsoft is doing that’s getting any real traction is Azure. Don’t get me wrong, I’m not abandoning C# and there is no way that I am going Java, but I am focusing more on Jsvascript and Node.
- wernercd 8y ago.Net Developer here and I've never been unable to find good paying jobs or expand my career in interesting directions. JavaScript is a good goal... but not because there's a lack of C# viability.
- scarface74 8y agoI am too and I have also being able to find good paying jobs. But back in 2008 there were also good paying jobs for good C and C++ developers. But when I looked at the direction that the local industry was going, I could see that the age of the bit twiddler was dying locally and there were more jobs for “enterprise developers”. I had a choice between making $20K more as a senior C++ developer or $7K more as a mid level C# developer. I took the latter even though I had 12 years (staying at one company way too long) of development experience. So that’s what I concentrated on for the next 9 years - the Microsoft stack. Late last year, I was the dev lead for a decent size company with a small IT department. I was looking to change jobs and once again I saw the writing on the wall. There were a few jobs willing to pay what I wanted writing C# but lots of companies wanted Node/React/React Native. This time, once again I was offered $15K more as an architect leading a team of 10+ developers writing apps in C# on Windows servers, running Sql server and I had another job offer as a “senior developer” at a smaller company making only $5K more but would get a chance to not only fill in some technical gaps on my end - front end coding with React and back end with Node. I would also get to lead initiatives to make the company more “cloud native” and to restructure the architecture for high availability, scalability, etc. and help build a dev ops culture. But with no official reports (that’s a good thing). Looking ahead three years, I knew what the better choice would be for my career. Sure there is money now for C# developers but that’s not where the market is going. But honestly, the salaries for developers and even architects who want to stay mostly hands on and don’t want to go into management outside of Silicon Valley/NYC is stagnating. I realized from my last job that the real money is working for consulting companies with titles like “Implementation architects” and “Digital transformation consultants” who help companies move to the “fourth level of the cloud maturity model”. Yes typing that left a bad taste in my mouth. So that’s really the game plan - but to speak to all levels of the organization, I need a “more modern tech stack” as one of the recruiters told me.
- maxmcd 8y agoThe idea of caching WebAssembly is touched upon in this article: https://hacks.mozilla.org/2018/10/webassemblys-post-mvp-future/ https://hacks.mozilla.org/2018/10/webassemblys-post-mvp-futu... (see "Streaming compilation" and "Implicit HTTP caching") Caching is also a helpful idea beyond the size of the initial download. Future compilers (cranelift), will have time to make multiple optimization passes on the instructions and save them for later.
- Matthias247 8y agoI think it wouldn’t even need to be a wasm task to cache these things. If the runtime is downloaded as a separate module, the browsers http cache should already do the job. What wasm might be able to do in addition is having a carved version of loaded runtime available in order to reduce startup times.
- userbinator 8y agoThe .NET and web development community both seem to have an obsession with adding abstractions, so it is not surprising to see such layering. In general it seems the vast majority of the web apps I've been forced to use are either slow, huge, or both, and I'm not convinced that should be the way it is. Edit: wow, downvotes. Not that I really care, but it shows the "stick the head in the sand and don't care about bloat, ignore everyone complaining" mentality that pervades the community...
- jf- 8y agoI didn’t downvote you, but I believe the response is that this isn’t so much the framework’s fault as the developer’s. There’s no reason that you must have a slow, huge web app regardless of what you use. That said, I do see current frontend technology being replaced by something in a few years, probably wasm.
- eeZah7Ux 8y ago> downvotes. ... ignore everyone complaining" mentality Echo chambers downvote anyone who points out the echo chamber behavior.
- manigandham 8y agoYou're considering your personal experience to be a fact of the entire .NET and webdev community, so is it surprising that people disagree? I've used and built many fast and lightweight webapps using .NET and other frameworks. Like most things, the tech has little to do with it.
- MarkSweep 8y agoThey are working on making .NET compile to wasm. There is still the GC, but it’sess overhead. Presumably this could be used for Blazor or something like it. https://github.com/dotnet/corert/blob/master/Documentation/how-to-build-WebAssembly.md https://github.com/dotnet/corert/blob/master/Documentation/h...
- masterofmisc 8y agoI think Blazor might have a bright future in the Electron space. Its seems to me the stars are all aligning from that point-of-view. Microsoft have had great success with Visual Studio Code and are now the custodians of Electron since they brought Github this year. Also, now that Microsoft are going all in on Chromium for Windows (and dropping Edge in the process) I wonder if they will introduce Blazor into Electron for better cross platform applications. I just get the feeling there is a play there (in some fashion)
- cm2187 8y agoNot so much electron than PWA, which will effectively standardise, cross platform, client apps. To me pwa+wasm is the solution to enable cross platform client apps AND a variety of languages and frameworks. And to free users (or rather developpers) from the various gated stores.
- rattray 8y agoI've never used .NET, and don't really intend to, but I think this is interesting nonetheless. This is on track to become a "built-in feature of ASP.NET Core 3.0" – recall that ".NET Core" runs on Linux, etc. Much C# development is still for internal business applications. For these applications, the overhead of shipping the .NET runtime to the browser in WASM - which https://blazor.net/ https://blazor.net/ sadly does not seem to mention - may not be a big deal, especially if they can be cached with service workers. Keeping engineers fungible and cheap to hire & train is a priority for enterprise software divisions. Software ecosystems that rely on the patience and curiosity of developers to explore an uncoordinated constellation of packages and design their own architecture (eg; Java, React ecosystems) can be suboptimal. .NET's historical "all batteries included, all applications the same" promise has been key here. But for rich frontends, Angular (their current choice) has, ah, high training costs. If Blazor works well, .NET Core may become the first truly full-stack, integrated, get-it-all-here, framework for modern web app development. As an uninvested bystander to enterprise software development, I'm curious to see how this goes.
- maccio92 8y agoWhy is .NET valid only for enterprise applications?
- rattray 8y agoSorry, I didn't mean to imply that it is. .NET, and C#/F# generally, can be useful in a tremendous variety of applications, and especially outside of the SF bubble, are used for... everything, startups included. .NET's most common use case, based on my research, is enterprise applications, but certainly not its only. Thanks for calling this out.
- rattray 8y agoExploring a bit, and sharing for those with similar curiosity... This seems to have a React-ish architecture with familiar C# templating (Razor): Razor syntax is the JSX-equivalent, which has been used for C# templating for years: https://docs.microsoft.com/en-us/aspnet/core/mvc/views/razor?view=aspnetcore-2.2 https://docs.microsoft.com/en-us/aspnet/core/mvc/views/razor... Blazor Components: https://blazor.net/docs/components/index.html https://blazor.net/docs/components/index.html Their docs are pretty scattered, especially for someone coming from React, but it seems to have similar features and lifecycle methods, albeit a bit more ersatz. onClick => onclick (etc) componentDidMount => OnInit / OnInitAsync componentWillReceiveProps => OnParametersSet[Async] componentDidUpdate => OnAfterRender[Async] shouldComponentUpdate => ShouldRender componentWillUnmount => Dispose There is also a convenient `bind` which is shorthand for `value="@Foo" onChange="@(e => Foo = e.target.value)"` and a magical `<FooComponent bind-Foo="@ParentFoo">` for passing state down... You don't seem to be able to define multiple components in a single file (which in my experience leads to bloated components). Routing seems to be defined within the .cshtml file rather than centrally, which can get messy in my experience. I don't see anything to support state that is shared across far-flung leafs of a deep UI tree (eg; Redux, Context), but maybe there are standard .NET constructs for that which I'm not aware of. I don't think this is going to win anyone from the React world – some design choices seem not to grok some key insights of React – but I can imagine it taking off amongst folks who were happy with server-side Razor templating and have been unhappy with Angular.
- k__ 8y agoHow big is this?
- xmichael999 8y agoAny decent examples of this doing something?
- sunnyP 8y agoHere are some Blazor demos. https://blazor.net/community.html#samples-and-tutorials https://blazor.net/community.html#samples-and-tutorials
- aphextron 8y agoWhat's the current state of this? Being able to develop with C# in the browser would be a dream, but the last I checked it wasn't really ready for any kind of serious use.
- kej 8y agoIt still carries huge "don't use for production" warnings, and only parts of it are slated for stabilizing in Dotnet Core 3.0. That said, it's fairly usable today, and I think there's enough interest in it that I'd be really surprised to see them abandon it at this point. I think it's worth considering for a personal project or something internal where you are going to do the back end in C# anyway.
- manigandham 8y agoIt's still in alpha stage but Blazor is one of the most exciting new developments and has seen tremendous feedback from the community so it's developing rapidly. The component model (Razor Components) for the UI is already committed to ship in .NET 3.0 so it can be used in server-side views, but the client-side WASM framework doesn't have a release date yet.
- AlphaWeaver 8y agoI feel like https://blazor.net https://blazor.net might be a better url for this post.
- untog 8y ago.NET on WebAssembly could be a really interesting escape hatch for companies that have heavily invested in .NET apps and want to move away from Windows. Right now downloading the whole framework is a prohibitively large task, but for internal apps it would probably be fine. Port something WinForms-ish over as well and those apps could be cross platform with not much work.
- kabes 8y agoWouldn't .net core just be that escape hatch?
- manigandham 8y agoAre you talking about cross-platform desktop apps? This has been an unsolved problem for a long time with many attempts, with Electron running web stacks getting the farthest at this point. Blazor is interesting in that respect but you can already use Electron today with JS and .NET Core powering the backend.
- sureaboutthis 8y agoI think one can use WebAssembly by itself just fine. In fact, I know this to be true.
- dang 8y agohttps://news.ycombinator.com/item?id=18135949 https://news.ycombinator.com/item?id=18135949