Announcing Masonry 0.1, and my vision for Rust UI
poignardazur.github.io
poignardazur.github.io
The amount of brainpower invested in the web platform dwarfs what any native toolkit has been given. No wonder it's so good; it would have been a crazy waste of resources otherwise. I'm sure native toolkits would be just as user-friendly, or even better, if they had such lavish resources dedicated to improving them.
With fewer developers working with these toolkits, we see less adoption, more issues, etc.
I disagree. Microsoft's WPF to me feels like GUI development done right. Designing UI components is a first-class citizen and even has WYSIWYG support, rendering data with observers is also a first class citizen with it's data binding feature, styling is also supported right out of the box, etc.
In theory frameworks like React sound nice, but once developers start to pour hooks left and right and add conditionals and move service client calls into trees then at least to me it quickly becomes an unreadable and unmaintainable mess.
Qt is pretty good to setup a widget tree, but it's model-view implementation feels broken and not thought through, specially with tables and trees.
I really do enjoy working with WPF. I just wish Microsoft would give us clear directions on the state of UI development on Windows, whether WPF has a future or not. MAUI doesn't feel like it yet because it feels mobile-first.
20 years old copy of Borland Delphi running on windows 95 machine will do that.
This probably won’t last btw. There is already backlash, people will start realizing that simply payinh for what you value is essentially a more direct way of voting for how you want the world to be, and business/technology will continue to follow the money.
Maybe a universal app container, like the web, but with native-like OS integrations will be the future, especially with future resource heavy technology on the horizon, like ML and AR/VR. But who knows?
Anyways, it’s not because os vendors don’t have their shit together. It’s because computing is still nascent and consumers have been cheap, so the revolution was funded elsewhere and that will of course change.
(Typed on my phone so sorry for typos)
And I think it's fair for someone to put together a proof of concept as a research proposal. They may not make it far in and of itself, but it may become an inspiration for someone else.
GUI crate maintainers have expressed interest in AccessKit; so far three crates have started using it (egui, rui, iced in a PR).
This suggests to me that these maintainers are interested in the idea of pooling work and that they're willing to use other people's work instead of NIH-ing their own library. (Though that doesn't mean Masonry is what anybody will settle on.)
The "potentially never stable" part is fair to worry about, but I disagree with the "start a new one" part.
While I do want to work on another UI library (Panoramix), this isn't what this post announces. The goal of Masonry is to promote code reuse. In my ideal scenarios, other libraries such as Xilem, Iced, SlintUI, etc... might come to rely on Masonry as their backend.
In fact, the "xkcd 927" problem is why I started Masonry in the first place: because I saw there were a lot of Rust GUI frameworks, but there was no crate that gave you a base to build a GUI framework from.
I wonder how common these things are, though, in other toolkits.
Also, accessibility tools like Microsoft's inspect[1] already allow people to see an app's widget tree.
With Qt it's also trivial to put together a tree view that renders your app's widget tree.
Qt also provides infrastructure to unit test widgets.[2]
Qt also uses UI form files to allow WYSIWYG access to their UI components.
From reading the article, I was left with the impression that the author's struggles with a Qt codebase was that he had little to no experience with desktop development in general and Qt in particular, and experienced issues trying to get his bearings.
[1] https://learn.microsoft.com/en-us/windows/win32/winauto/insp...
... Holy crap, how did I never hear of this? I did search for Qt testing infrastructure before writing this article too.
When I see posts like this, it only shows how little current generations know about native tooling, mostly because they only focus on FOSS stuff on GNU/Linux instead of what is available on other systems, or eventually paid for tooling.
The other issue is that most people are looking for cross-platform options outside the C/C++ ecosystem. While I understand the tradeoffs for cross-platform UX, the truth is that it's only the giant amount of money placed into browser development that has made it even remotely productive.
(Independently, I think we would be better off with a reinvention of the Java Web Start idea that disposes with the bad foundation we have for web applications, but that's a different blog post.)
It's documented as part of the official qt documentation https://doc.qt.io/GammaRay/ and is part of the commercial Qt for Automotive Suite.
I think this is an instance of "the future is already here, but it's unevenly distributed". All the tools I talk about in this post already exist in one way or another. Browser devtools already exist, rr and redux-replay already exist, pernosco already exists, etc.
But a lot of developers haven't heard about them (eg I suspect most Qt developers haven't heard of Gammaray), or can't use them for their specific use-case. And in the case of Rust UI, lots of greenfield frameworks are being developed that don't have these tools by default.
So Masonry isn't aiming to somehow be better than every existing desktop GUI framework. It's aiming to help Rust framework developers include these tools by default, so that developers always know to reach for them.
They are okay-ish, if you know the rules of the target code system/platform. (Ie. if you know React, and so you already create components in the UI builder.)
So basically my big problem is that these UI builders don't force/encourage the conventions that result in nice code.
The potential is there, of course, maybe even throwing a chatGPT-like AI in the loop can help with recognizing what the user wants and emitting and maintaining the resulting code base.
On a more serious note, would be interesting to see an app builder inspired by the UI and Blueprint editors of UE but tailored for apps rather than games.
Unreal Engine might be a bit overkill since it has too many dependencies built in (you don't need a state-of-the-art 3D renderer and physics engine for UI). Godot is much more lightweight than that (about 40~50 MB from my tests, at least better than Electron), but some might still think that's too much though.
A lot of this stuff is out there, it's just usually requiring things like dealing with C++ or some other language.
I don't even need it to be interactive: all I want is a UI-oriented DSL with live-preview. Which is why I personally think SlintUI is currently way ahead of the competition.
The author basically suggests a DSL themselves despite this framework's UI being Rust constructs, as they note the importance of fast iteration and then say that because of Rust's slow compile times it's probably not the ideal language.
A DSL provides more than fast iteration too. It also encourages good code quality by forcing you to separate the app's UI from the rest of the logic. And complete language control means that a true DSL with its own syntax will always be more readable than anything you can embed in Rust's.
This concept of separation is always interesting to me.
In the 1990s, when MVC was first conceptualized, a GUI was (a) native (b) playing the dual role of both View and Controller. It is quite hard (not impossible, but hard) to separate the app's UI from "the rest of the logic".
Consider trivial interactions (i.e. the Controller side of the UI element) like drags. What does a drag do? How do you conceptualize limits on the motion? How do you convey semantics between the Model and the Controller? How do you handle the differences between clicks (essentially drags with no movement) and actual drags? How does the Controller handle both axes? Gestures? etc.
Remember: the UI is the thing that receives input events from <somewhere, and in its capacity as the Controller, alters the Model state, which in turn causes changes in the appearance of the UI (as the View). This then creates additional issues if changes to the Model state are expensive (i.e. the Model contains/controls heavyweight resources), and thus Controller interaction must first work on a "pseudo-model" which is also represented by the View aspect of the UI, until the interaction is complete, at which time, the Controller propagates the actual change(s) into the "real" Model.
Yes, quite a bit of this has been revised/extended/expanded (e.g. Microsoft's View-Model concept), but the basic issues remain, and make the kind of separation you're thinking about hard to do in practice for all but basic data presentation applications.
The problem, such as it is, is that the original examples they tended to use involved systems where the View and Controller were physically separate systems. Consider a medical scan data viewer with (a) a screen (b) a series of controllers to manipulate what appears on the screen.
In this context, all 3 of MVC are clearly identifiable and easy to talk about and understand.
But as it got applied to GUIs where there are no distinct physical controllers and all the interaction occurs intimately tied to the View (i.e. what's on the screen), it is harder to find the boundaries between the V and C parts (and to some extent even the M).
... But I can pretty much do this today with Tauri? The missing bit here IMO is why we need to rebuild webdev-like tooling in a Rust-only framework rather than just use it.
But you're definitely right that devex is one of the web's main strengths. It's really hard to replicate that without a massive community like the one the web has; that's going to be a sticking point for any native framework (which if we're honest, are going to remain a niche going forward)
Even with cross-platform frameworks, there's a big fragmentation problem right now. And even if there weren't, native development as a whole is simply a smaller community these days
It's not the size of the community. It's the use of interpreted languages and strong introspection and a (relatively) consistent platform called "the browser". That's what make devex so different to native.
Sure, the endless stream of new frameworks etc. also contributes to the difference, but it's not as fundamental IMO.
But even so, would you stake a current native UI toolkit to last longer, and provide more value, before that day?
There are good reasons to write truly native UI. Performance is very persuasive. Longevity, perhaps less so.
If you stake the basic ideas of the framework on the DOM, then DOM details will become implementation details which will become details that clients will depend on. And you'll have just re-written React but with even more layers.
It needs to be thought about in terms of first principles, ala SICP. There are basic primitives to be defined that are the "ground," and then it is built up from there.
More seriously though, that's a fair question. Anything that isn't the web has a lot of catching up to do before it can compare to the web.
(Though browsers are increasingly relying on rust frameworks for low-level work, so there's some potential for code reuse.)
My gut feeling answer would be "because things built for the web have a tendency to fail for no reason, and things built in Rust have a tendency to work on the first try". I'd have a hard time backing up that gut feeling with hard numbers, but I think it's a shared one. Web techs tend to have all sort of legacy cruft and small papercuts and stuff. Mature Rust crates are easy to install, work immediately and have an intuitive API. My hope is to get to a point where developing Rust GUI is just easy, no papercuts.
(But again, lots of catching up to do first.)
If you're comparing legacy web code to new and modern rust crates of course it's not a fair comparison. just wait until the until the second wave of rust gui libs, it will be a similar pain of legacy code when the web industry went from Angular v1 to React. Legacy projects, outdated packages and brittle build processes, now with rust there will also be the added "benefit" of a more complicated programming language.
Stop saying stuff like this. It's not true and it pushes people away bc you look fanatic
It’s not all sunshine and roses, and the lack of things like browsers’ dev tools can certainly be painful, but Rust honestly is good enough to warrant serious consideration even in spaces where these difficulties apply.
PoignardAzur was speaking lightheartedly, but I honestly don’t think it’s an unreasonable general sentiment.
1. https://iced.rs (MIT)
2. https://slint-ui.com (GPL)
For slint, there is an online editor: https://slint-ui.com/releases/0.3.4/editor/?load_demo=exampl...