this post was submitted on 26 Dec 2023
126 points (96.3% liked)

Programming

17417 readers
76 users here now

Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!

Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.

Hope you enjoy the instance!

Rules

Rules

  • Follow the programming.dev instance rules
  • Keep content related to programming in some way
  • If you're posting long videos try to add in some form of tldr for those who don't want to watch videos

Wormhole

Follow the wormhole through a path of communities !webdev@programming.dev



founded 1 year ago
MODERATORS
 

it seems ridiculous that we have to embed an entire browser, meant for internet web browsing, just to create a cross-platform UI with moderate ease.

Why are native or semi-native UI frameworks lagging so far behind? am I wrong in thinking this? are there easier, declarative frameworks for creating semi-native UIs on desktop that don't look like windows 1998?

you are viewing a single comment's thread
view the rest of the comments
[–] Hundun@beehaw.org 39 points 10 months ago* (last edited 10 months ago)

It's not that native UIs are lagging behind, there is a whole set of reasons.

TL;DR: browsers, as opposed to desktop apps, are stardartized - because they were originally designed to display and deliver text documents. We were never supposed to build complex application UIs on a web stack.

First, there is no standard way of making native UI on a desktop. Every OS uses it's own solution, while Linux offers several different ones. Browsers rely on a set of open standards developed specifically for the web, and even there not everything works exactly the same.

Second, browsers are designed to draw a very specific kind of UI through a very specific rendering mode - they run an immutable hierarchy of elements through layouting and painting engines. It works great for documents, but it becomes extremely unweildy for most other things, which is why we have an entire zoo of different UI implementations (crutches, most of them) for browsers.

On the desktop we often make a choice of what UI technology would fit best our purpose. For a game engine I would use an immediate-mode UI solution like ImGUI, for the ease of prototyping, integration and fast iterations.

For consumer software I might choose between something like QT or GTK for robust functionality, reliable performance, acessibility and community support. Mobile platforms come with their own native UI solutions.

For data-intensive UIs and heavy editors (e.g. CAD, video and music production, games) I might need to designan entirely new rendering pipeline to comply with users requirements for ergonomics, speed, latency etc.

It is also easy to notice that as a team or employer, it is often much easier to hire someone for web stack, than for native development. Simply put, more people can effectively code in JS, so we get more JS and tech like Electron enables that.

If you are interested in a single solution that will get you nice results in general, no matter the platform - you might see some success with projects like Flutter or OrbTK.

UI rendering in general is a deep and very rewarding rabbit hole. If you are in the mood, this article by Raph Levien gives a good overview of existing architectures: https://raphlinus.github.io/rust/gui/2022/05/07/ui-architecture.html