A little bit of background
Somewhere in 2019, I started running into challenges that I had a hard time solving with my weapons of choice, Flutter and Kotlin. While there are many, many scenarios where a mobile app makes perfect sense, I found myself working on apps that really shouldn't have been apps in the first place. The only reason they were apps at all, were because solving these challenges on web is hard.
This left me feeling that I'm using the wrong tool for the job. Why couldn't a web app handle the work? I've seen what some folk have done in the browser, and I was sure there has to be a way to use modern web technology to solve these challenges.
The journey begins
The last time I took a look at Wasm, it was in the popular Microsoft technology solution called Blazor. This allows you to target web browsers using .Net and C# and is a really powerful tool if you are already invested in the .Net stack.
I gave Blazor a try and found it to be well-supported, quite mature and fun! In my scenario though, the tremendous overhead of having the entire .Net runtime loaded into Wasm was a price I did not want to pay. The fact remains that Blazor is a great technology and it's going to change the game for .Net users, but it's not what I was looking for.
Since I've been doing a lot of Kotlin Multi-Platform work in Kotlin Native, I decided to take a look at what Kotlin from JetBrains had to offer. It quickly became apparent that it's a bit further down the roadmap than I'd have liked and that, right now, Kotlin targetting Wasm is not at the stage where I'm comfortable suggesting it as a solution to clients. This is a great pity, because I've done some really interesting Kotlin work, both in the mobile and API solution spaces.
C and C++
These are the big, dependable options, but also the nuclear option. I saw some interesting and really impressive work done in Wasm using both C and C++. What did trouble me a bit was that I didn't really want to dig into them again, as they were just not suitable for my usual day to day work. This did lead me down the Rust path, but I'll save that for last.
Next up, Go, by Google. Go has Wasm support and there are many examples of it being used for that reason. As a language, I found Go interesting and well-documented. The tooling around it seems mature and there are a lot of Golang jobs and resources out there. The challenge with Go, at the time, was that it was also quite heavy and I didn't find good examples of the kind of problems I wanted to solve.
Good old Python has been a mainstay of calculation solutions for a long time, so I figured it could not hurt to look into it. I found a lot of interesting, though early stage Python projects in the Wasm space and this is an interesting one to watch. Python has such a rich ecosystem, I'd be very keen to see it embrace Wasm.
Finally, I decided to look at the Rust, seemingly scariest option out there. Every single blog or website I read, basically said the same thing: The learning curve is steep. Steeper than you'd think and you really need to unlearn some thought patterns to truly get Rust as a language. At first, this seemed like it's not even worth digging into. After spending some more time reading about Rust, how it works and looking at examples of what people are doing with it, I decided to take the plunge and try it out.
A couple of things that stood out right from the start was the consistency of the language, the number of Wasm-related examples and the mature tooling and documentation. Rust comes with a great installation manager and ships with a very friendly tutorial.
All the other solutions are really great and are getting better all the time. For example, .Net developers will gain so much by trying out Blazor and Python developers have a lot of options, depending on their requirements. In my case, I was in a position to dig into a new language and ecosystem and I jumped at the opportunity.
After immersing myself in Rust for a few weeks, I found myself surprised at how expressive the language is, pleased with how fast the compile cycle is for most things and how quickly I was making progress. In the months since then, I've managed to migrate some Java, Kotlin and Dart code to Rust and get it working in the browser. Rust has become my tool of choice for many of the challenges I need to solve for clients. Coupled with how well it integrates with web applications, I see myself using a lot more Rust in the future.
Return to the blog index