Introduction to WebAssembly for .NET Developers
Uno Platform
Posted on October 11, 2019
Guest Blog Post by Antonii Georgiev
I really feel that we are on the brink of a revolution. It’s still very early in the revolution, but I feel like WebAssembly is going to completely change the way we think of web applications.
WebAssembly has slowly been stirring up fire since its creation, but why exactly should you be interested in it?
Firstly, what is WebAssembly?
WebAssembly operates on a stack-based machine that allows web applications to run near-native speed by using a binary format. It can be generated by higher level programming languages like C++ or C#. The idea is that it runs a lot faster than JavaScript.
It’s quite efficient, meaning it’s fast to load and execute. It’s safe and portable just the way JavaScript is. You don’t have to deal with memory overflow exploits and things of that nature. Lastly, it’s portable so it will run in almost any modern browser nowadays.
WebAssembly is not intended to kill JavaScript, and it probably won’t. Maybe someday it might replace JavaScript in certain scenarios, altering the way we write our web apps just enough that we may end up writing the majority of our applications in an entirely different language.
Secondly, when should I target WebAssembly?
Heavily CPU-bound number computations are your best bet – things that deal with math – WebAssembly really shines with these. The most common things that come to mind for engineers when they think of numbers are games or 3D visualizations. But you can write mostly any web app using WebAssembly if you please.
For the most part WebAssembly is a fairly new technology, and not all of its application factors have been figured out yet.
What does this mean for .NET Developers?
Browser system applications have been engineered in JavaScript since the early days of the Web, meaning C# developers would need to either work with more than one language or avoid browser system development altogether. WebAssembly may change all of this by providing the bridge for .NET developers to enter the browser.
Right now, if you want to write an application that is running in the browser you have to leverage JavaScript, but there are some new things that have come around with WebAssembly. We are beginning to step away from the days where JavaScript rules the browser only and new tech is being introduced to the ecosystem. This is where new WebAssembly-inspired tech enters the picture.
Blazor
Blazor is an experiment backed by Microsoft and made by the ASP.NET team that allows you to create your own web app using C# and Razor-like syntax. It gives us the ability to write C# code on the client-side of a web application. In a way it’s almost like a replacement for powerful JavaScript frameworks such as Angular or React. Unlike the mentioned frameworks though, Blazor has an easier and quite smooth learning curve.
Uno Platform
Uno Platform is a project that aims to provide users with the opportunity to build mobile, desktop and WebAssembly apps with C# and XAML, all from a single codebase. Developers define their UI in platform agnostic markup language XAML, which in turn renders the application’s native UI elements. Developers new to XAML don’t need to do a lot of homework to get used to it, because it allows devs to reuse many of their skills such as MVVM, databinding, controls, etc.
WebAssembly wrap-up
Even though the technology is a couple of years old by now, we’re still in the early stages of its existence, while not clear in what direction it might turn in future releases, it looks quite promising and it’s likely to be very popular (it’s already a big conversion topic 😉 ).
The post Introduction to WebAssembly for .NET Developers appeared first on Uno Platform.
Posted on October 11, 2019
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.