Hello and welcome to the WebAssembly course, WebAssembly is currently a cutting edge technology for
the web.
A few years ago, I remember when React entered the scene.
It was a total game changer.
For years, developers created apps with a library called jQuery.
At the time, writing an app with React was utterly foreign to most web developers.
If you were one of the lucky few to understand, react, companies wanted to hire you.
It was one of the most in-demand skills.
Times have changed.
Various frameworks have popped up over time.
It's considered a standard skill for most web developers to know a front end framework.
History is repeating itself.
A new technology has rose called web assembly.
It's become very desirable to no web assembly in today's market.
That leads us to the question What is WebAssembly WebAssembly as a language for the web?
JavaScript has been the dominant language for decades.
It's unlikely this fact will change.
JavaScript is an awesome and powerful language.
However, there are some shortcomings that can't be ignored.
To better understand, let's talk about systems programming versus applications programming when learning
about programming.
Most students have various paths at their disposal.
Generally speaking, we can categorize programming into two categories which are systems, programming
and application programming.
Application programming focuses on software with a UI.
Users are meant to interact with this type of software, whereas system programming focuses on the hardware
of a computer.
Creating operating systems, game engines, industrial automation and drivers can be considered the
types of programs that can be done with systems programming.
JavaScript is mostly utilized for application programming.
These two worlds are not always separate.
For example, a web server can be considered a systems program.
We need web servers.
If we want to deliver JavaScript apps, you're most likely work with a backend developer to work with
servers.
Technology is progressing very fast.
We're starting to see a transition from desktop apps to web apps.
However, not all desktop apps can be transitioned easily.
For example, financial apps work fine on the web, but not video editing software.
This is because video editing software requires access to a computer hardware to process videos.
Therefore, browsers need to expose access to a user's hardware.
Do they use JavaScript or some other language?
Like I said before, JavaScript is a beautiful language.
I'm biased, but its popularity is undeniable.
For a user, interfaces JavaScript works great for assistance programming.
That's another story.
Designing a web or mobile app is mainly done through Photoshop that's starting to change Figma as a
product for designing apps in the browser.
You don't need to install a program to get started.
Simply visit Fig Montcalm and you're good to go.
In recent years, designers have fallen in love with Figma.
They're using Figma to design apps over a Photoshop.
The most exciting thing about Figma is how it ports features from a desktop app to a web app.
Unfortunately, processing and editing images require access to hardware.
It's not easily done with JavaScript.
It's possible, but slow.
In the resource section of this lecture, I provide a link to a blog post by the Dev team.
According to this article, the developers struggled when launching Figma on time.
For example, opening a file would take over 10 seconds thanks to web assembly.
This time was reduced to about three seconds.
Incredible, right?
By using web assembly, developers can write apps for the web without compromising on performance.
You may be thinking, Doesn't this kill JavaScript?
Not necessarily.
The Figma team still uses JavaScript for UI elements like buttons, inputs or events for CPU intensive
tasks.
They use web assembly.
Unlike JavaScript, WebAssembly does not provide an API for selecting or modifying elements.
It's not meant to write an application.
Instead, it's intended to give developers a way to access the system's hardware.
If we need to handle user interactions, JavaScript will work.
WebAssembly is for computational tasks.
Hopefully, this clears up the goals of WebAssembly.
You may be itching to get started, but there's one more thing I want to mention.
Typically, developers will not refer to WebAssembly as a language.
Technically, it is, but there's a better word to describe it.
WebAssembly is seen as a compilation, targets a compilation target refers to the language targeted
by a compiler.
If you're familiar with TypeScript, you may be familiar with this concept.
To the dismay of many developers, TypeScript does not run in the browser and has to be compiled from
TypeScript to JavaScript.
JavaScript can be considered a compilation target.
It's the language targeted by the compiler.
Similarly, WebAssembly is not meant to be written and read by humans and said we can use our favorite
programming language after we're finished writing our app.
We can compile it to web assembly.
You may be thinking, why should we use another language?
There are two main reasons for writing web assembly with a different language.
Firstly, it allows developers to continue writing code in their preferred language.
A C++ developer can write WebAssembly without dedicating their weekend to learning a new language.
They can get started right away.
Secondly, web assembly is not an easy language to learn.
Let me show you an example of web assembly code.
In my editor, I have opened a Web assembly text file.
This file is huge.
There are about 400000 lines of code.
Even if I wanted to, I don't think it's possible to go over every line of code in a single course.
In another tab, I have a rust file with the original code instead of thousands of lines of code.
The original source code is less than 40 lines.
You tell me, do you want to write four hundred thousand lines of code or 40?
I'm going to guess forty.
The creators of WebAssembly didn't intend for developers to write WebAssembly code.
Rather, they recommend choosing another language.
Thus, you should treat WebAssembly as a compilation target.
The question is which language should we use?
WebAssembly supports dozens of languages.
We can use C++, C, Sharp, Java, Go, Python, Rust, etc. The list goes on and on.
It can be challenging to choose a language for this course.
We're going to be using a language called rust.
Rust is considered the most beloved language by developers, but don't take my word for it.
StackOverflow conducts the largest programming survey in the world.
Thousands of developers submit responses to their survey.
For the past few years, Rust has been rated as the most loved language.
Scott Logic, the largest newsletter for web assembly, conducts its own survey for a web assembly developers
from their survey.
Rust is considered the most popular and desirable language for web assembly.
You're very likely to encounter a WebAssembly project written with rust out of all the languages available.
In the resource section of this lecture, I provide a link to a repository with a list of supported
languages.
Not all languages are fully supported.
For example, you may be tempted to use JavaScript or Python.
Unfortunately, these languages are not fully supported.
Developers prefer a language with a strong background in systems.
Programming languages like C++ or ROS are considered the cream of the crop.
For that reason, we are going to be learning rust in this course.
We're going to focus on learning the fundamentals of rust after we've become familiar with rust.
We'll move on to WebAssembly.
I have a mini project planned for this course.
By the end of this course, you'll have a project you can proudly add to your portfolio.
When you're ready, I'll see you in the following lecture.