News for hackers. Stuff that matters.
Re:Rust 2020: GUI and Community by quantummkv on Saturday November 09, 2019 @10:13PM (#21496163)
Honestly, writing a cross platform gui is a waste of time. Java tried it(multiple times) and failed. Electron tried it and the results are terrible. Qt is moderately successful at it mostly because it is treated as the system toolkit on a lot of Linux platforms and Windows users are conditioned not to care about consistency and experience because of bad enterprise CRUD apps and Microsoft's own inconsistent behavior.

What rust should do is focus more on interop with other languages. Write your critical business logic in Rust and make that cross platform. Then write GUI in the platforms preferred Library/Language combo that handles all the UI and makes calls to a cross platform rust binary for grunt business logic processing.

Re:Rust 2020: GUI and Community by tiew9Vii on Sunday November 10, 2019 @12:47AM (#21496611)
I recently looked at JavaFX not expecting much.

It's come a long way from the Swing days and I think the biggest issue is it's perceived history, Java / Swing being slow and ugly. The other issues is the lack of marketing of what modern JavaFX can do.

So I wouldn't call it a failure, it's plodded on in the background improving slowly over time, where it has failed is on market adoption.

Re:Rust 2020: GUI and Community by zvrba on Sunday November 10, 2019 @02:39AM (#21496924)
I've started a project from scratch based on JavaFX and am very happy with the toolkit.
Re:Rust 2020: GUI and Community by pjmlp on Sunday November 10, 2019 @12:12PM (#21498906)
Even Swing is quite capable, but it does require to learn how to use it effectively, which a large majority never bothered to.
Re:Rust 2020: GUI and Community by hombre_fatal on Saturday November 09, 2019 @10:25PM (#21496212)
> Electron tried it and the results are terrible.

I use VSCode, Slack, and Discord every day (and some other Electron apps). The results are great and better than anything I've seen in the xplat space where there are always trade-offs.

Re:Rust 2020: GUI and Community by quantummkv on Saturday November 09, 2019 @11:05PM (#21496328)
Is Electron better than most cross platform alternatives? Yes. Is Electron better than platform's native tooklit? No. Electron apps are easily recognizable because they completely stand out from the platform apps (not in a good way). And there are other concerns that are addressed in the numerous electron threads on HN so I won't list them here.
Re:Rust 2020: GUI and Community by 0_gravitas on Saturday November 09, 2019 @10:34PM (#21496232)
i think that is part of GP's point, if Electron is the best we can do, then thats not a great sign. im a regular discord user and used to heavily use VSC, but i had to abandon it, for my uses it was far too heavy for what it was.
Re:Rust 2020: GUI and Community by Razengan on Saturday November 09, 2019 @10:41PM (#21496262)
There are definitely trade-offs with Electron. Higher CPU, RAM and battery usage compared to native apps, and on macOS at least, the loss of features which native controls get for free.
Re:Rust 2020: GUI and Community by bpye on Sunday November 10, 2019 @03:08AM (#21497018)
I feel that Electron is bad not because you're running the same UI everywhere but rather because you're running an entire web browser.
Re:Rust 2020: GUI and Community by simion314 on Sunday November 10, 2019 @07:40AM (#21497751)
Web technology is designed for documents and making non toy apps is a pain, if I may give you a few examples of issues I hit this week:

- I wanted to create a grid of img like elements(something a bit more complex where you have some small buttons on each image), I hit the issue that the browser would take like 2 seconds to load 1000 elements, in a decent GUI toolit this is not a problem, as an example in Flex4 I can have a list with 1000 elements, if only 10 elements are visible then the toolkit creates say 16 GUI elements, as you scroll the elements that get out of view are recycled , in Web you either create all 1000 GUI elements(that each element is maybe formed with a giant div soup) or you use a infinte scrolling like pattern, check Youtube as an example, go to a specific channel video list, you see only 2- 3 rows of videos, then you scroll and wait for next few rows, scroll and wait again, scroll and wait again ...tldr web GUI performance is really bad

- native components are limited, you can't css properly and consistently a numeric input(you can't css the colors of arrows to fit your styles) , you can't have a dropdown that contains icons or some more complex thing like a "Font Families dropdown" , you can't customize the dropdown scrollbar colors so you are forced (is not my fault that desingers want shit to match in theme and not have white crap on a dark theme) to find or create custom components, so you get to import JS libraries and most of the time this components are broken, Ex check the youtube search dropdown, it happened a few time for me to get the dropdown in the search to get stuck open, only way to fix it is to reload the page, Google devs can't properly implement a correct dropdown widget. In PayPal their custom input widget to enter money does not support the "Del" key . In a decent widget toolkit you extend the existing widget, you get all the existing functionality and you add your custom features on top in Web you start with DIVs and CSS do a mediocre job and then fix the issues that get reported if you have the time.

All this issues are solved in Qt, Flex or WPF, the components are performant, you can customize without losing basic features, you don't have to research shit like "what library should I use Monday to implement the numeric spinner input" .

Re:Rust 2020: GUI and Community by danShumway on Sunday November 10, 2019 @10:35AM (#21498349)
> Web technology is designed for documents

CSS/HTML have some pretty significant problems, but this hasn't been true for years. And in any case, 90% of the native apps I use are basically interactive documents anyway. Unless your definition of "non-toy" apps is primarily referring to apps like Blender or Photoshop, most of the native apps on my computer could be trivially represented in HTML.

You should think of HTML as a render target, not as a document layout framework. HTML isn't where you lay out your application; HTML is where you present your application's data to the user.

> in Web you either create all 1000 GUI elements[...] or you use a infinte scrolling like pattern, check Youtube as an example, go to a specific channel video list, you see only 2- 3 rows of videos, then you scroll and wait for next few rows, scroll and wait again, scroll and wait again

The reason you wait on Youtube is because it's making network requests, not because the HTML is slow to insert. The way you would solve this problem if you weren't worried about network performance would be to use a virtual DOM, because the DOM is a rendering target, not a layout framework.

"Native" controls on the browser do restrict you quite a bit, but that's at least partially on purpose, because the whole point is to use "native" browser conventions with those components. How many times on HN do we see people complaining about scrolljacking on a website? And you want people to be able to style scrollbar colors on top of that? There was significant debate on HN about a month ago about whether it was even a good idea for browsers to respect `autocomplete="off"` in input fields. A significant chunk of your users do not want you to do this kind of stuff.

What the web does do is that it provides you mechanisms to avoid the native components if you have a really, really pressing need to do so -- while encouraging you that most of the time, using built-in browser behaviors will be better for both you and the user.

If Twitter was using native components and not hijacking browser behavior, text input wouldn't insert extra spaces whenever you copy-pasted. If PayPal was using a regular numeric input instead of some custom-built monstrosity, it would respect the delete key and render more consistently with your browser theme. If Youtube wasn't forcing itself to be a single-page app, you wouldn't get bugs where videos failed to load on navigation.

Seeking pixel-level control over every element is the opposite of how you get applications that look and feel native. Looking and feeling native means respecting platform settings and conventions.

Re:Rust 2020: GUI and Community by simion314 on Sunday November 10, 2019 @11:15AM (#21498566)
About Youtube or my example with a big image grid, do you think you can fit all those JS frameworks and tracking in memory but you can't fit the title and thumbnail url of 200 videos ? you have an array with this 200 objects if titlke,video url, thumbnail url , the network request you will do lazily for the thumbnails and you can load the next row of thumbnail in the background while I am scrolling down. I am not talking about loading all at once, you load only what you need and a bit more so when you scroll down the stuff is already p reloaded , let me know if this is not clear and I can explain (I profiled my app and it was spending 2 seconds in the native browser layouting code)

About the scrollbars, I am not taling about a document side scrollbar, think at an example of a dropdown with all the font families, those have a scrollbar, I don't want to reimplement the scroll. I want to use the native widgets but the designers decided we will use a dark professional looking theme and the native scroller can't be styled with css, I know the discussions we ahd here on HN about the main page scrollbar and I agree we should use the native widget but we should be able to color it to match the webpage colors , what you will notice in application not webpages is that everyone is using custom component, nobody uses the native dropdowns,scrollbars,calendar, numeric inputs, the reason most of the time is that you are forced into using custom widgets because teh native ones are limited, are not customizable enough.

I 100% agree with you about pixel perfect and styling but I am just a developer, I implemented this weak the numeric input using the native input, I presented it to my boss and they asked me to respect the design, so tomorrow I will have to hunt for a JS library that implements this, look trough it's bug tracking for it's issues etc. I hate I have to do this but6 is not my decision and my initial point is that this is a reason why Web apps are bad as performance or UX , this custom components can run code on your mouse move events, on your clicks, on your scroll events , a native component would be faster and have less bugs and more features.

Re:Rust 2020: GUI and Community by ClumsyPilot on Sunday November 10, 2019 @09:06PM (#21501573)
There have been a few great product delivered on Java, such as IntelliJ.

Visual consistency with the underlying OS is an overblown concern. The application needs to be well-designed and performant.