Hacker News new | ask | show | jobs
by ori_b 3967 days ago
> I kind of wonder why nobody has written a library that acts as a thin layer around and abstraction of native UI toolkits

Because a native UI is more than just widgets. It's also the layout and naming of buttons. It's the number of toolbars and how they're arranged. It's the phrasing of dialogs. It's integration with the platform keychain. It's the colouring of your icons. And hundreds of other little things.

There are plenty of libraries -- QT, wxWidgets, etc -- that all try to wrap or emulate native widgets, but there's always something subtly wrong, because getting all that right is hard.

2 comments

The problem with existing libraries is that they try to do away with the notion of different platforms in favor of a metaplatform. In reality, the divergent nature of platforms must be embraced in some ways. I imagine the aforementioned hypothetical thin wrapper as providing really easy ways of getting per-platform right; for instance, it could know the standard control heights and whitespace on each platform and automatically adjust your program's UI accordingly. It also wouldn't be hard to set up a system that allows for per platform verbiage, icon assets, etc.
It's also widget selection; On Android, for example, you may want a hamburger menu. On KDE, your menus get reshuffled compared to your OSX or Windows UI.

I've seen plenty of systems that allow you to do mediocre UIs on all platforms. I haven't seen one that allows you to do an excellent UI without doing once per platform.

I think the answer here is to have a "base menu" that all applications start with instead of starting from zero and having developers fill in the blanks. The base menu knows where to put common special items (Preferences/Options and About for example) on each system, and developers build on top of this by adding their own custom items.

I'm not saying that it's possible for a cross-platform UI toolkit to be perfect, but it's certainly possible to get a lot closer to right than current toolkits do.

Maybe if we use a Sufficiently High Level description of the interface, we could Do Better This Time.
Insanity