Hey guys,
I have no prior programming experience whatsoever and want to build a real-time chat app. For various reasons that have to do with my professional experience I dislike JavaScript and I want to build my app without using any JavaScript. I recently found out about this new standard WebAssembly that is now natively supported by browsers and I am curious about a couple of things since there’s still not a lot of info about it plus it’s harder to navigate for a noob like me. Please help me answer a couple of questions:
- Is WASM handling the front-end or the back-end part of a webapp?
- If I understand correctly WASM can interface directly with client-side hardware and do something called “serverless”. Does that mean that WASM apps are both front-end and back-end at the same time?
- Can WASM be used to replace JavaScript in a web app (incl. UI/UX)?
- I noticed that only LLVM-compatible languages can be used to program to WASM. So if you are building a webapp in WASM does that mean you build the front-end in Rust + WASM and the back-end in something else like Python, or is it all WASM?
- I am also interested in learning Common Lisp and I noticed that CL is also LLVM-compatible. Would it be a bad idea to learn Common Lisp instead of Rust to program to WASM and kill two birds with one stone?
- Is it an overkill to build simple webapps with WASM or is it efficient and faster regardless of the project’s scope?
Thanks.
- WASM is “just” a bytecode format. It can be run on the frontend and the backend.
- What do you mean with client-side hardware?
- Some browsers support it, but AFAIK there’s still no standardized DOM binding for WASM meaning you need some external library to interact with the DOM. If you really really dislike JS for frontend stuff you have some alternatives. See below.
- The frontend and backend usually communicate using HTTP which means your backend can be written in just about any language.
- Both are fine languages but they are VERY different in terms of abstraction levels and philosophy. I would not attempt to learn both at the same time
- WASM still can’t really do GUI, but maybe you can hook into it from JavaScript (or anything that compiles to JavaScript).
A general note: WASM is faster yes, but it is very, very rarely the execution speed of the JavaScript engine that is the bottleneck in an app. It is much more likely to be some combination of inefficient DOM manipulation, networking or just plain old slow code.
Languages that work in a browser (off the top of my head):
- TypeScript: JavaScript with types, much nicer tooling.
- Google Dart
- Elm
- Kotlin
- Java: Using GWT or using something like Vaadin
- Scala
- ClojureScript (LISP family)
… the list goes on
Frameworks I recommend:
- React + TypeScript: Probably the one to learn right now, a lot of mindshare and a lot of resources.
- Angular: 2nd place after React in popularity. Uses TypeScript.
Rust is quite strict and I couldn’t imagine it being a good fit for UI compared to TypeScript, especially in the crazytown that is the HTML DOM.
I have used GWT and Vaadin in large enterprisy companies, would not recommend these unless you want a job in some specific company that uses these.
DISCLAMER:
I’ve done full-stack development professionally for around 10 years.
I have around a year of experience in Rust, 2-3 in TypeScript and too many in GWT.
EDIT:
Elaborated.
Edit 2:
If you have no prior programming experience a full-stack setup is quite a mouthful. I recommend starting with something smaller.
2 Likes
WASM is a standard to compile anything (that supports it) that your browser can then interpret. It does not have much to do with your backend. Your backend won´t be compiled to WASM. But it does enable you to share common code between your backend and frontend.
What you use in your frontend also does not dictate what you use in your backend. WASM does not really change anything there.
C# Blazor should be able to do that without Javascript… Well it still uses Javscript, just assuming Blazor will do everything you ever want it to, you don´t write that Javascript. As the person above said WebAssembly can´t really interact with the DOM all that well yet. So really Blazor uses Javascript to do that internally.
Though, I think “I dislike Javascript” is also a little bit silly as a general statement. I also partially dislike javascript in asp.net as it kinda feels like developing the “hack” to make the framework work in a modern day. If you use a real javascript framework like react, vue or angular where javascript isn´t treaded as an accidental citicen of the framework, things are a lot different (as in a lot nicer). You should give it a try. You might actually like it. I really do think people generally dislike javascript for all the wrong reasons (or like you with no reason given).
Ultimately, it´s your decision what you use for your frontend and if you wanna go with blazor it´s a fine choice.