Chetan Mittal
Chetan Mittal Dev - Tech Blog


Chetan Mittal Dev - Tech Blog


WebAssembly reminds me of Java Applets and Macromedia Flash

Let us explore are WebAssembly software programs like Java Applets and Adobe Flash Programs?

Chetan Mittal's photo
Chetan Mittal
·Apr 8, 2023·

2 min read

WebAssembly reminds me of Java Applets and Macromedia Flash
Play this article

Rust programming language is meant to write software for low-powered hardware devices, the majority of which include IOT devices, embedded devices such as industrial machines, robotic devices, etc.

WebAssembly is a virtual machine (a software program) that is inbuilt into modern browsers, such as Chrome, Firefox, Safari, Edge, etc., to download and execute a binary file(s) (a compiled software program specified in the <script> tag in your HTML file) inside the browser.

A majority of WASM software programs are written in the Rust programming language. Though these can be written in C/C++ and Ruby-Lang too.

See the diagram below:-

WASM binary files are included in the HTML files the same way Javascript files are included inside a <script> to tell your browser that there is a web-assembly file that it needs to download and execute.

<script src="mymodule.wasm"></script>

Unlike Javascript which is interpreted on the run, from the source file, without any compiling; WASM binaries are pre-compiled files meant for fast execution and safety.

Java Applets and Adobe Flash were the same, a software program pre-compiled into a binary file running within the browser.

And similar to WASM binaries needing a software program in the browser to get downloaded and executed, both the Java Applets and Adobe Flash needed a browser plugin to get downloaded and executed within the browser.

During my early days in software programming, I built a few websites based on Java Applets and I seriously remember the nightmares I used to have while debugging those.

In 2023, I use either Ruby or JavaScript for building software applications, using VIM and Visual Studio Code, and both programming languages are really easy to debug on the fly than C/C++ and Java, and Rust.

I wouldn't definitely want to go back to the old days of having debugging nightmares and waiting hours while my Rust or C/C++ files for WASM are getting compiled.

I would say, using WASM would make more sense than JavaScript only where there is a need for a CPU-intensive software program execution because of being written in Rust and compiled.

The best examples could be:-

  • Games inside the browser

  • Image, audio, and video editing inside the browser

  • Machine learning computations inside the browser

  • Etc

Do you have any other examples where WASM could be used best? Please comment.

Share this