WASM as a Front-End Framework

๐Ÿ•“ Sep 16, 2019 ยท โ˜•4 min read

What?

No, there's nothing wrong with the title.

People out there. Much smarter than me, have done things I'd never have imagined. They've (yea, plural), built multiple (again, plural) front-end frameworks for compiled languages such as Go, Rust and .NET - just to name a few - have already implemented a way to compile down named back-end languages into WASM.

Amazing, if you ask me. Will this become the new SaaS?

WaaFE? WASM as a Front-End?

They - the smarter people - have also given them names, thus they must be official. Names such as Vecty, Yew and Blazor, each unique and awesome in their own ways. Even Java/Kotlin/Scala has kind of their own implementation too. This one is called Vaadin.

Pretty neat, ‘eh?

Why?

That's an easy answered question. If it has not been made, someone will create it. If it already exists. It'll be re-implemented by others as-well.

Easy peasy, lemon squeez-y.

Also, not all language-maintainers will do this, if it does not fit into their domain. Though, lot's of high-level languages - used for the web - will, at some point, do something like this. Either to gain the users back, or to fetch new users. That being said, no-one should only ever stick to a single language. To know multiple languages is always a plus in my book.

This is much like in the real world - outside of the computer, and sometimes inside too! To talk to people from different galaxies of the universe - even the continents of earth, one or another must yet a language to communicate with other people. Why, though? Well, because not all are willing to learn another language. Thus you won't be able to speak with them.

One might think as this as multilingualism, yet it is. Why do people not want to learn another language, you might ask yourself. Probably, some are just a bit xenophobic? Lazy? Unmotivated? All of the above? You're right! Everything takes every other thing into account, when talking about the human-races. Even other races, like the felines and k-nines. Not all learn to like one-another, though, those who do, will live long and prosper.

Phew, this took a sideway, that it wasn't supposed to. Now, back on track.

Usefulness?

Is it even useful to go-pher - haha - WASM? I cannot answer that question, but take a look at this demo by David McNeil. He did a great report on this exact question. The speeds of WASM are kind of incredible, as shown below.

results of WASM vs plain ol’ JavaScript

On the above image, the results shown are of an implementation of the K-means clustering-algorithm - CPU-bound. Read more on this on the demo-site. If you're too lazy. Well, I've given you an image to look at. What more do you want? I don't want to take the whole article away from him, as it's quite good. Not to say great! Filled with stats and benchmarks (wait, aren't those two kind of the same thing?).

Used?

If I've used WASM? Only a few - three - times, all done in rust. Two minor games and a site. I've found rust to have a rather steep learning curve, though, and I'm not the only one! Go search ask the interwebs. They'll say the same thing. It's a tad less steep, if you've ever programmed in C though.

Anyhow, this is just my words, and you should take them with a gran of salt. I'm still just learning programming, of which I've been doing over the past many years - that's the fun of programming, you can always learn more.

Needed?

Will you ever need WASM? I truely think so. It's slowly, but steadily, moving forward in the world of the interwebs. Even companies like Autodesk have (old news) ported at least parts of their engine into the web. Pretty awesome, ‘eh?

- Thanks,

Mads Cordes


Mads Cordes
WRITTEN BY
Mads Cordes
Dev of Sorts