DEV Community

Cover image for WebAssembly and the evolution of web front end development
Rommel Suarez
Rommel Suarez

Posted on

WebAssembly and the evolution of web front end development

Javascript has played a very important role in shaping web development over the years. It has evolved so much that it is now used to write software solutions other than browser applications. It has also been adapted to write server side applications and machine learning. Indeed, javascript has become very popular and powerful nowadays. However, as javascript matures, web front end development is still on its early stage. 

Alt Text

Innovation starvation
The web browser has been around for about 30 years. However, better user experience on web apps only began just recently. It only started when smart phones arrived and dominated the market. Suddenly HTML5 was introduced and Single Page Applications or (SPA) conquered the web browser. Also, during this time, ECMAScript finally unveiled ES6 that gave modern features to javascript implementations. JavaScript libraries and frameworks such as ReactJS, Angular, Vue and more have sprouted everywhere. But why did it take a while for us to make these innovations? Why do we need to wait for smart phones and tablets to realize these needs?

Alt Text

Someone has tried to make innovations, but failed
Innovations like this has been done years before to help developers create modern and responsive web app without javascript. Notably, Sun Microsystems built and design Java to run Applets in the browser to make a better user experience. Who would forget Microsoft Silverlight and Adobe Flash that were built for creating rich internet applications. But ultimately there is one thing in common about them, they all failed because they are not naturally part of the browser as compared to javascript. You need to install a runtime environment in order to run these type of applications in the browser. For some reason, some browsers stopped supporting it, especially on mobile phones.

Alt Text

Why javascript alone is not sufficient?
When working with machine learning, API development and game development you could choose the tools and programming language you want. However, in the web browser there is only javascript. Javascript is good, but it's not the best. Sadly, it's the only one we have. There are a lot of pitfalls and weirdness on javascript. The good and the bad of javascript are widely discussed on the book "Javascript the good parts" written by Douglas Crockford. Even though ES6 tried to solve those issues, not all browsers supported it yet. So developers relied on transpilers. Transpilers read codes written in ES6 and spit out javascript guaranteed to work anywhere even on some old browsers. You can also use other programming languages to help you write better codes and again use transpilers to convert them back to javascript. However, the browser doesn't know these languages, they are just a facade. Try to debug your code from the browser and you'll be surprised. It would be great if one day we can have the freedom to build apps in the browsers where languages like C#, Java, C++ and your favorite programming languages can natively run and debugged in the browser. Just compile it into machine code and the browser can execute it faster without any third party run time environments. You don't have to use transpilers and other tools such as webpack, grunt and gulp to run your codes on the browser which I think are just hacks and workaround to make javascript work. And still, you have the option to use javascript. That means development will be easier and simpler. You can use one language to build your app. You can write better and efficient codes because most of the features that javascript is missing are already built in other languages.   

Alt Text
WebAssembly to the rescue
On 2015 WebAssembly was first announced to the public. It has proved the possibility of running an application written in a language different from javascript. And yes, everyone was astonished. It's like a dream come true. It doesn't need a third party run time environment. A game written completely on Unity3D was compiled to target WebAssembly with a binary format. It can execute on the browsers with a performance close to native code. This has opened up a lot of possibilities for app development on the browser. Developers that have no background in web development can now write apps that run on browsers. They don't even need to be an expert on CSS,HTML or javascript. WebAssembly is very promising and most browsers are supporting it now. It's still very young and there's more work coming along to make it better. One of the major excitement is Blazor WebAssembly. It's a framework for building Single Page Apps using C# created by Microsoft. It's an open-source framework where you can use and build .Net Core components of your app and run it in a browser. Before, you can only use javascript to build this kind of applications. I'm pretty sure, with this innovation a few more technologies and frameworks that uses a different programming language will come out. It's a pretty exciting future ahead of us isn't it?  

Top comments (0)