5 ms·
Not to criticise the (very well written) article, but IMHO the best solution for rapidly prototyping cross platform GUI applications in Ruby is Electron[1] + Hy
by lf-non 9y ago
Not to criticise the (very well written) article, but IMHO the best solution for rapidly prototyping cross platform GUI applications in Ruby is Electron[1] + Hyperloop[2].
GTK applications look very outdated/out-of-place anywhere outside linux, and especially on OS X.
While electron has its issues (large bundle size, memory footprint), it is a really flexible solution for cross platform desktop applications. It will still not have native appearance, but a modern L&F is quite easy to arrive at using CSS and libraries like react-desktop.
Relying on the browser runtime ensures that most of the form widget interactions work as users would expect them to on their own platform.
Opal[3] is a really good ruby to javascript compiler which can be used to target electron. This is particularly promising given that the hyperloop [2] ecosystem has significantly matured. Hyperloop provides a full fledged component oriented client-side development framework powered by best of breed frontend technologies/patterns like virtual DOM (through react integration [4]) and flux stores.
---
[1] https://electronjs.org https://electronjs.org
[2] https://github.com/ruby-hyperloop https://github.com/ruby-hyperloop
[3] https://github.com/opal/opal https://github.com/opal/opal
[4] https://github.com/ruby-hyperloop/hyper-react https://github.com/ruby-hyperloop/hyper-react
- jeffbax 9y agoIMO, they both feel very out of place. One just eats 10x the memory of the other. Not sure that is a better trade off. If an electron app is pretending to be native, it's pretty much a giant sign telling me to look elsewhere. I get the ease of development argument, but it always feels like garbage even when done "well" like Slack. VS Code is about the only thing that pulls things off OK, but even that is notably slower than alternatives and I blame nobody for sticking with Sublime.
- lf-non 9y agoIt is not about a ui pretending to look native. It is more about form interaction patterns that users are subconsciously habituated to. For example: - Pressing enter submits a form. - Clicking on a label focusses the input box. - In OS X readline style shortcuts are available in all input boxes, eg. Ctrl+a takes you to beginning to line, Ctrl+e takes you to the end etc. When these things don't behave the way you expect them to, it really destroys the user experience. Building on browser runtime gives a lot of these platform specific accessibility features to you for free - which may not be very trivial to arrive at through cross platform native gui libraries.
- jamesgeck0 9y agoWhy bother with Electron? Qt is lightweight, has Ruby bindings, and looks native on everything. Use Furoshiki to build distributable binaries for each platform.
- 52-6F-62 9y agoI just recently started experimenting with Qt and it is an actual charm to work with. I haven't tried out any bindings or languages outside of C++ with it yet, and haven't built anything serious, but I understand the love some people have for it better after trying it.
- bigtunacan 9y agoIs this the Furoshiki project you are referring to? https://github.com/shoes/furoshiki https://github.com/shoes/furoshiki I'm just wondering since it says it is alpha and only supports Shoes.
- jamesgeck0 9y agoOh, whoops. I knew it was mostly used with Shoes apps right now; I didn't realize it literally didn't work with non-Shoes apps.
- inferiorhuman 9y agoAs a fan of Qt I've gotta disagree there. Qt looks native on X11 systems but looks really out of place on OSX.
- djsumdog 9y agoI started down the electron path and will probably back out. So many get-started things in electron are just massive boiler-plate. Electron-vue is awful boiler plate with so much pre-made crap I don't understand how any of it fits together and some really simply stackoverflow questions have gone forever without being answered: https://stackoverflow.com/questions/48337401/unable-to-test-better-sqlite3-within-a-project-based-on-electron-vue-boilerplate https://stackoverflow.com/questions/48337401/unable-to-test-... Not to mention electron apps are massive (Slack is 90M+ for a fucking chat client. Audium/Pidgin anyone?) Electron is a huge step backwards really. I don't see why people praise it so much.
- tomc1985 9y agoHell no, get that Electron garbage out of here. It produces slow, ugly applications using a framework that has no place on the desktop. Also, excessive transpilation is something people should really look down upon. Learn to work with the framework that runs, don't go and come up with CoffeeScript or w/e GTK doesn't look dated, it just looks simple