Will WebAssembly overtake JavaScript in Web Application coding needs?JavaScriptWebAssemblyJavaScript vs WebAssemblyWhy is WebAssembly superior to JavaScript?Will WebAssembly replace JavaScript in popularity among programmers?
On Tuesday Firefox 52 became the first browser to support WebAssembly, a new standard “to enable near-native performance for web applications” without a plug-in by pre-compiling code into low-level, machine-ready instructions. What were the reasons for Firefox ditching two-decade-old JavaScript in favor of the relatively new WebAssembly? In this article, we look at whether WebAssembly will replace JavaScript as the preferred programming language for Web Applications.
JavaScript
JavaScript was first conceived in 1993 in the heady days of Internet Explorer and Netscape Navigator. The then king of browsers, Netscape Navigator founder Marc Andreessen believed that Netscape needed a “glue language” to support HTML that would be easy to use by Web designers and part-time programmers to assemble components such as images and plugins, where the code could be written directly in the Web page markup. Also Bill Gates’ Microsoft Internet Explorer was eating into market share of Netscape Navigator forcing Andreessen to recruit Brendan Eich with the goal of embedding the Scheme programming language into its Netscape Navigator. In 1995, JavaScript was developed under the name Mocha, the language was officially called LiveScript when it first shipped in beta releases of Netscape Navigator 2.0 in September 1995, but it was renamed JavaScript when it was deployed in the Netscape Navigator 2.0 beta 3 in December. Netscape Navigator met its eventual death at the hands of competition from Google;s Chrome, Microsoft’s Internet Explorer and Mozilla’s Firefox. However, JavaScript lived on to this date powering the way how our webpages look like. Not to be confused with Java, JavaScript is a high-level, popular, powerful, dynamic, untyped, and interpreted programming language. JavaScript is a scripting language that makes the pages interactive. JavaScript is the most commonly used programming language to create cool websites and games for the web. It derives much of its syntax from the C Language. Through JavaScript, you can add pop-up messages, etc. In recent years, JavaScript has also gained use as the foundation of Node.js, a server technology that among other things enables real-time communication.
WebAssembly
WebAssembly is a comparative tot in programming arena. WebAssembly was first announced on 17 June 2015 and on 15 March 2016 was demonstrated executing Unity’s Angry Bots in Firefox, Chromium, Google Chrome, and Microsoft Edge. WebAssembly or wasm is a low-level programming language for in-browser client-side scripting, which is currently in development. Its initial aim is to support compilation from C and C++, though other source languages such as Rust are also supported. As it is relatively new, it does not have a rich history to boast of but relies heavily on using the popularity of C and C++ to become the preferred coding language for web application developers.
JavaScript vs WebAssembly
Till a few years back, no one would have imagined a Web Application without JavaScript. It was and still is the go-to programming language for large swathes of web developers. However, with Firefox opting for WebAssembly as preferred coding language for developing native apps and browser plugins, it could mean a turning point in web development and how our browsers work.
Why is WebAssembly superior to JavaScript?
WebAssembly uses C and C++ compilations to make its web apps work. It also supports other source languages such as Rust. But probably WebAssembly’s best weapon against JavaScript is its speed. That is the reason Mozilla trusts its future Firefox browsers with WebAssembly. Mozilla engineer Lin Clark sees this as an inflection point where the speed of browser-based applications increases dramatically. With smartphones reaching the length and breadth of planet Earth, more and more users are joining the Internet. However, due to vagaries of service providers, the Internet speed is not the same everywhere. This creates a need for superfast web applications and fast loading browser plugins. WebAssembly looks to take JavaScript head-on with its inherent advantage in speed. David Byrant, Head of Platform Engineering at Mozilla is apparently sold out to WebAssembly. He has written a full-fledged Medium blog post to explain why Firefox is banking on WebAssembly rather than on JavaScript for its Firefox browsers. Byrant explains that WebAssembly will enable amazing video games and high-performance web apps for things like computer-aided design, video and image editing, and scientific visualization. Over time, many existing productivity apps (e.g. email, social networks, word processing) and JavaScript frameworks will likely use WebAssembly to significantly reduce load times while simultaneously improving performance while running. Unlike other approaches that have required plug-ins to achieve near-native performance in the browser, WebAssembly runs entirely within the Web Platform. This means that developers can integrate WebAssembly libraries for CPU-intensive calculations (e.g. compression, face detection, physics) into existing web apps that use JavaScript for less intensive work.
Will WebAssembly replace JavaScript in popularity among programmers?
It is too early to predict the death of JavaScript. However, technology is a dynamic world and in constant evolution. With virtual reality and augment reality being billed the next technological revolution, the browser are required to deliver web pages at breakneck speeds. WebAssembly is seen as a possible solution to this. JavaScript was originally intended as a lightweight language for fairly simple scripts. It needed to be easy for novice developers to code in. You know — for relatively simple things like making sure that you fill out a form correctly when you submit it. Web apps written with WebAssembly can run at near-native speeds because, unlike JavaScript, all the code a programmer writes is parsed and compiled ahead of time before reaching the browser. The browser then just sees low-level, machine-ready instructions it can quickly validate, optimize, and run. Byrant says that WebAssembly could change what it means to be a web developer, as well as the fundamental abilities of the web. With WebAssembly and an accompanying set of tools, programs written in languages like C/C++ can be ported to the web so they run with near-native performance. We expect that, as WebAssembly continues to evolve, you’ll also be able to use it with programming languages often used for mobile apps, like Java, Swift, and C#. However, till the big daddy of web, Google embraces WebAssembly in its Chrome browsers and Chromium project, JavaScript is here to stay. As a wannabe programmer, you could look to taking up WebAssembly as the demand for fast loading web apps is certainly on the rise.