The question
-
I want to write some cross-platform applications in Rust.
-
These applications need GUIs.
-
I don't want to commit to any single GUI crate / framework / technology, but want to be able to explore alternatives, so I want the business logic to be decoupled from the GUI logic.
-
Mention of JavaScript and mainstream web-app development practices makes me break out in a cold sweat.
Can you recommend an approach to writing GUI-enabled Rust applications with business logic decoupled from GUI code?
Background Rant
Back in the last millennium (1999) I wrote a web-based visualizer for 3D Computational Fluid Dynamics data, in JavaScript, directly fiddling around with the DOM.
I hated everything about this experience (except for the final result, which looked pretty and made a bunch of people happy), as far as I can recall for 2 major reasons:
- JavaScript: a language that made C++ look sane by comparison.
- The first browser wars: every problem needed to be solved at least twice, in incompatible ways, in the same code base.
Doing battle with C++ involved sufficient intellectual challenges to make the pain bearable, but the JS + DOM experience was pure soul-crushing torture which made me determined to give JavaScript and web applications a veeeery wide berth. So imagine my growing sense of unease and disgust over the next decades as JavaScript and web apps took over mainstream programming and, to a large extent, became a core activity for the majority of software developers. It is as if the world has been taken over by zombies, and I spend my life hiding in zombie-free enclaves.
I have mostly avoided the need to write GUIs in my Real Work, but I have an increasing number of side-projects which don't make sense without them. I would like my GUIs to be
- cross-platform
- written in Rust
- have the business logic decoupled from the UI.
Imagine my horror, especially as a physicist, at discovering that Electron
- nowadays means: Build cross-platform desktop apps with ... JavaScript, HTML and CSS
- is the de-facto standard way of building cross-platform apps.
Down the years, various words such as React, Vue and Angular penetrated into my consciousness. I don't really know what they mean, but I do associate them with the zombie apocalypse so they trigger angst. Looking at the various options for building GUIs in Rust (and elsewhere), I see that
-
A large proportion of the documentation assumes that you are a zombie: familiarity with React/Vue/etc. is taken for granted, or similarity to them is touted as a major advantage of the solution.
-
The business logic tends to be deeply entangled with the UI.
For example, is it possible to write an app using Dioxus for the GUI, without fully committing to expressing your business logic in Dioxus itself? (Repeat the question with Dioxus replaced with just about any other framework. Iced and the Elm architecture seem the least guilty here.)
Please help me get over my deep-seated dread of JS-related stuff so that I can write some GUIufl apps in Rust. Is it possible to write the business logic core of such apps in a GUI-agnostic way?