It seems that you're using an outdated browser. Some things may not work as they should (or don't work at all).
We suggest you upgrade newer and better browser like: Chrome, Firefox, Internet Explorer or Opera

×
low rated
Just something I have been thinking about:

Suppose I want to write an app(lication), and I want it to run on both desktop and web platforms, and I am wondering what the preferred way of doing this would be.

Specifically, suppose I need to be able to target the following desktop platforms:
* Windows
* Mac OS
* Linux (64-bit x86)
* Raspberry Pi

And also the following web browsers (regardless of underlying OS):
* Firefox
* Chromium

I have found two main approaches and am wondering which one is preferred, or if there is another idea I haven't even thought of:
1. Develop the app as a web app and use Electron (or a similar technology) to create the desktop versions.
2. Develop the app as a desktop app in a language like C++ or Rust and use a compiler that targets WebAssembly (like emscripten) to port it to the web.

So, any thoughts? What would you do as a developer? What would you prefer as a user?
avatar
dtgreene: What would you prefer as a user?
whats the intended purpose? / why would i want it? / whats the hell will it try and take from me?

what do you mean by "web apps" in this specific case?

- answers to those would be a good start to get useful feedback for yourself.
avatar
Sachys: what do you mean by "web apps" in this specific case?
An application that runs inside a web browser, rather than having to be installed locally.

Basically, to run a web app, you take a modern web browser (with things like JavaScript enabled), go to a specific URL, and you're running the app.

Examples of web apps include:
Gmail (mail.google.com)
Google Docs (and anything similar)

There are also web app versions for things like Discord and Zoom (though the Zoom one is somewhat hidden).

Cookie Clicker is another example of a web app (just go to https://orteil.dashnet.org/cookieclicker/ and you're playing Cookie Clicker).
Writing a web app and wrapping it in Electron seems like the new black.

In my infallible opinion, Electron is pure evil and web GUI looks fscking ridiculous on the desktop.
Lots of people disagree. They're wrong, of course, but when one billion flies like poo, one gourmet insect isn't going to change much.

Emscripten-QT is, AFAIK, stone dead. Don't know if there are any alternatives. But then, I suppose a desktop GUI will look out of place on the web too.

For large applications that are worth the extra development time for Doing It Right(tm), my favoured way is definitely to have all the business logic independent of any GUI, and specify the GUI in your own format that you can instantiate using whatever platform's native components.

For just playing around, Blazor is a very interesting web-targeted tech, that Microsoft are working on.
They're looking into various ways of rendering with native components too.
One caveat is that .NET Core (which Blazor runs on) will not run on the smaller Raspberry Pis (Gen. 1 and Zero). It should run on Pi 2+, though.
I don't know how performant Blazor in the browser will end up being.

Also check out ReasonML + Revery. The idea is nice, and the result is very performant.
The only reason I haven't gone anywhere with it myself, is that their toolchain (https://esy.sh/) is one huge pile of smelly poo, IMHO.
But that might just be me. I never seem to have much luck with anything that is based around the Node.js ecosystem.
Well, I would say you have two components here:
Front end and back end.
Front end is the UI, which could be written in various things, you could even setup a simple pipeline to build to different platforms, therefore have the native capability. Electron is a cross platform app, but from what I read it is a big chunk of code and memory heavy. Also, using chromium does of course mean any electronically stored information in the proximity to it will get sucked into the google data hole.

Backend could be written in pretty much any language. Are you going to have communication back and forth, maybe database? Plenty of free DB’s out there. One language I see around a fair bit is GO, and wouldn’t mind learning it myself. It compiles to multiple OS’s, is lightning quick and tiny, but has no UI part.
I do like C# and use it a fair bit, shame that VStudio is such a monster. Liked the simplicity of sharpdevelop. That has a new cross platform component.

Perhaps a better question would be to write down each element you want. Then assign tools to those elements, see what matches best.
If I'd want to do something cross platform I'd either go React Native or Flutter. Flutter's disadvantage is that you need to learn yet another language but it's faster. As for the backend, there are too many options
This thread is why we can't have nice things.

The web is shit. "web apps" are shit. And DEVELOPING "web apps" is a Cthonic nightmare. Electron is what the Devil would be were it real and a piece of software.

Desktop is always better. ALWAYS. Works better, performs better, codes more easily...
Post edited April 01, 2020 by mqstout