4 ms·
>C++ (and even Rust) is not the best language to build UIs. Why? And why are scripting languages better?
by qekbg 7y ago
>C++ (and even Rust) is not the best language to build UIs.
Why? And why are scripting languages better?
- ygra 7y agoDeveloper productivity when building or redesigning a UI is often far more important than raw performance. There's usually no noticeable difference for a user whether the dialog they opened via a button click is built in highly optimized C++ or from an XML resource stream that is read, parsed, and the UI constructed on the fly by effectively interpreting the UI description. It's okay to have expensive abstractions where a few milliseconds simply don't matter, but tasks can be done in minutes instead of hours. Declarative UI descriptions also have the benefit of being friendly to visual designer applications, so you need fewer build/run/test cycles (which are far from quick with C++).
- qekbg 7y ago>There's usually no noticeable difference for a user whether the dialog they opened via a button click is built in highly optimized C++ or from an XML resource stream that is read, parsed, and the UI constructed on the fly by effectively interpreting the UI description. I dare you to compare the speed of UIs of Windows XP and Windows 10, even when using the hardware that was current when those OSes were released.
- hedora 7y agoSomeone did a detailed study of UI responsiveness vs year. Responsiveness peaked in the 80’s, in the dumb terminal + regional mainframe era. :-(
- badsectoracula 7y agoDo you have a link? If it is the one i remember it was about keyboard-to-output responsiveness (and the winner was something like a C64 or Apple 2 or something like that), not overall UI (and i'm a bit skeptical about the dumb terminal part considering the communication latencies involved, especially in the 80s).
- blub 7y agoThis "productivity is more important than raw performance" meme again... Your first paragraph claims the opposite of what's happening reality: there is a noticeable difference between clicking that highly optimized C++ button and going through XML, as seen in Mozilla's XUL or typical web apps. I can't even imagine why you'd think that reading and parsing XML and constructing a UI would be cheaper than any other way of building UIs.
- coldtea 7y ago>there is a noticeable difference between clicking that highly optimized C++ button and going through XML, as seen in Mozilla's XUL or typical web apps. Really, did you measure it? Since we are, scientists and everything? Where are the numbers? And how do any differences you've found compare (timing wise) with human initiated action and perception latencies -- like those required to click an on-screen button and see it being depressed? >as seen in Mozilla's XUL or typical web apps You see button being pressed time/action as a problem in "XUL or typical web apps"? (Memory consumption when the drawing is done with DOM, or slow rendering of large scene graphs, I'd buy -- but this is not the model we're talking here, where JS calls a native control directly, and doesn't render through DOM/web rendering). >I can't even imagine why you'd think that reading and parsing XML and constructing a UI would be cheaper than any other way of building UIs. Actually that's the way tons of native apps work, from games, to Gnome, to Windows and so on. Second, if you think the "parsing a XML UI declaration" is in any meaningful way more expensive that imperatively calling a bunch of UI functions directly, you have a distorted idea of what makes a UI slow, or of the time needed to parse an XML file and initialized controls based on it...
- rat9988 7y ago>Really, did you measure it? Since we are, scientists and everything? Where are the numbers? This remark should (also) have been directed at his parent comment, who made the contrary claim without any measurement either. > Second, if you think the "parsing a XML UI declaration" is in any meaningful way more expensive that imperatively calling a bunch of UI functions directly, you have a distorted idea of what makes a UI slow, or of the time needed to parse an XML file and initialized controls based on it... The numbers?
- oblio 7y agoMemory management.
- codr7 7y agoThe user interface tends to be a relatively dynamic part of the application. Most of this is no longer as relevant in C++, can't speak for Rust. Programming languages have been converging for quite some time, C++ of today is more dynamic and convenient than any version that came before. That being said, you can't beat dynamic languages for some tasks. Runtime code generation/eval being the most obvious I can think of. Any kind of extension/plugin architecture has everything to win from going all in with a full scripting language from my experience.